RSA (Rivest–Shamir–Adleman) is a public-key cryptosystem that is widely used for secure data transmission. It is also one of the oldest. The acronym RSA comes from the surnames of Ron Rivest, Adi Shamir and Leonard Adleman, who publicly described the algorithm in 1977.
- Choose primes
p = 3
andq = 11
. - Compute
n = p * q
= 3 * 11 = 33 andφ(n) = (p - 1) * (q - 1)
= 2 * 10 = 20. - Choose
e
such that1 < e < φ(n)
ande and φ (n) are coprime
. Let e = 7. - Compute a value for
d
such that(d * e) % φ(n) = 1
. One solution isd = 3
<=>(3 * 7) % 20 = 1
- Public key is
(e, n) => (7, 33)
. Private key is(d, n) => (3, 33)
. - The encryption of
m = 2
isc = 2^7 % 33 = 29
. - The decryption of
c = 29
ism = 29^3 % 33 = 2
.