# Question:DocumentTools problems for decryption

## Question:DocumentTools problems for decryption

Maple 17

This is the coding till i do dhe decryption process.

Do(plaintext=GetProperty("message",value));
Do(plaintext=convert(GetProperty("message",value),name));
Do(plaintextInt = convert(plaintext, bytes));
Do(plaintextBin = `~`[convert](plaintextInt, binary));
Do(plaintextBin2 = map2(nprintf, "%07d", plaintextBin));
Do(n0 = plaintextBin2[]);
Do(length1 = length(n0));
Do(plaintextCode = cat("", plaintextBin2[]));
Do(length2 = length(plaintextCode));
Do(z = convert(plaintextCode, decimal, binary));
Do(z1 = z+1);
Do(z2 = z1+%sk1);
Do(z3 = convert(z2, base, 2));
Do(b = cat("", z3[]));
Do(z4 = length(b));
Do(z5 = [Bits:-GetBits(-z2, -1 .. 0, bits = z4)]);
Do(z6 = cat("", z5[]));
Do(z7 = convert(z6, decimal, binary));
Do(%C = `mod`(Power(z7, %txte), %txtN));
Do(%C1 = `mod`(Power(%sk1, %txte), %txtN));

Do(%m = `mod`(Power(%C, %d), %N));

Do(%sk2=`mod`(Power(%C1,%d),%N));

Then nw i need to decrypt back to the original message with the coding:

Do(z8 = [Bits:-GetBits(-%m,-1 .. 0, bits = z4)]);
Do(c = cat("", z8[]));
Do(z9 = convert(c, decimal, binary));
Do(z10 = z9-sk2);
Do(z11 = z10-1);
Do(z12 = [Bits:-GetBits(z11, -1 .. 0, bits = length2)]);
Do(d = cat("", z12[]));
Do(plaintextBin2 = [StringTools:-LengthSplit(d, length1)]);
Do(plaintextInt2 = `~`[convert](plaintextBin2, decimal, binary));
Do(%message1 = convert(plaintextInt, bytes));

when i execute the program it shows the error

so how should I solve this as although i think that it should be problem of parsing the number z4 in the sentence that i highlighed, but whenever i correct it it still can't work.Thus anyone who know please help.Thanks.

﻿