I'm trying to apply the RSA cryptosystem to encrypt a byte M=72, using predefined modulus n, public key exponent e and private key d.
(n, e, d, p, q) = (4802, 5, 59, 43, 8)
In order to accomplish that, I used the following code on Python console:
C=(M**e)%n
M=(C**d)%n
print M
- the first instruction encrypts the byte as C: using the RSA encryption mathematical expression (
**stands for exponentional, and%for modulus in Python programming language) - the second decrypts C to get M back: using the RSA decryption mathematical expression.
However, the output shows:
2816
which means that M was incorrectly computed as '2816', although I'm pretty sure that all the values of n, e, d, p and q respect the RSA public key algorithm specification.
Does anyone have any idea?