Decryption of a RSA encrypted message is not working.

481 Views Asked by At

Using RSA with e=13 (encrypting power), d=17 (decrypting power) & n=33 (RSA modulus) I noticed that once I decrypted the encrypted message it would be different then the original message. Why is that??

I used the primes p=11 & q=3 to get the modulus n=33. So the totient Phi(n) = k = 10*2 = 20

By choosing e=13, (d*e)mod(k)=1 d is 17.

.

If I encrypt "4"

(4^13)mod(33) = 31

Decrypting "31" to get back "4"

(31^17)mod(33) = 28 (It's not working)

.

Though by using e=3 & d=7 it works. Is there a relationship to these numbers??

1

There are 1 best solutions below

1
On

Might as well state that it was just a precision error.

Changing (31) to (-2) "fixes" the problem, since (31)mod(33) == (-2)mod(33).

And ((-2)^17)mod(33) = (-29), where (-29)mod(33) == (4)mod(33).

So it comes down to that one should use more than 8 bytes or use smaller numbers.