RSA Reloaded
- pick two large (n-bit) random prime p and q.
- public key is (N,e) where N=pq and e is a (2n-bit) number relatively prime to (p-1)(q-1).
A common choice is e =3 because it permits fast encoding.
- secret key is d, the inverse of e modulo (p-1)(q-1), computed using the extended euclid algorithm.
Instances:
public key | p | q | N | (p-1)(q-1) | private key | raw msg | encoded received | decoded it out |
(n=3233,e=17) | 61 | 53 | 3233 | 3120 | (n=3233,d=2753) | 13 | 47 (13 **17 % 3233) | 13 (47 ** 2753 % 3233) |
(n=55,e=3) | 5 | 11 | 55 | 40 | (n=55,d=27) | 13 | 52 (13 **3 % 55) | 13 (52 **27 % 55) |
References: