# Math Help - RSA algorithm check if ive done it right please

1. ## RSA algorithm check if ive done it right please

Using an RSA code with the encryption integer e = 3 and distinct primes 3, 41 encode the message M = 5. Determine the decryption integer and check your encoded message by decoding it.

to get the decryption integer:

mod n (3-1) * (41-1) = 80

e*d = 1 mod 80

3*d = 1 mod 80

d = 27

to check message

im not sure how to do any help please?

2. Say $p = 3$, $q = 41$, so $n = 123$, and $\varphi{(n)} = (p - 1)(q - 1) = 80$.
Say $e = 3$. Use the extended Euclidian algorithm to find that $d = 27$ (because $27 \times 3 \equiv 1 \pmod{\varphi{(n)}}$.
Now, $M = 5$, so $C \equiv 5^e \pmod{123}$, so $C = 2$.
Now, $C = 2$, so $M \equiv 2^d \pmod{123}$, so $M = 5$.

Thus this is correct.