You are on page 1of 1

# Please read the RSA algorithm and the example given below, do the

exercise by yourself

RSA algorithm
1)
2)
3)
4)

Select two primes p and q
Calculate n = p x q
Calculate φ(n) = (p-1) x (q-1)
Select e such that 1 < e < φ(n) and gcd(φ(n),e) = 1 (e and φ(n) have no
common factor, except the 1)
5) Find d which is the inverse of e modulo f(n):
d=e-1 (mod φ(n) )

or

d x e/ φ(n) = k(the quotient) with 1 remaining
(here we do not care about the quotient k, but the remainder has to be

1)

How does the cipher work?
Public key pair KU = {e,n}
Private key pair KR = {d,n}
M – the original text (Plaintext).
1) Use public key KU to encrypt the plain text M into cipher text
C= Me (mod n)
2) Use private key KR to decrypt cipher text (C), then you get the plaintext (M)
Cd (mod n)  M

Exercise:
1)
2)
3)
4)

Choose p = 7 and q = 11
Compute n = p * q = _________________
Compute φ(n) = (p - 1) * (q - 1) = __________________
Choose e such that 1 < e < φ(n) and e and φ(n) are co-prime. Let e =
___________
5) Compute a value for d such that (d * e) % φ(n) = 1. One solution is d =
_______
You choose the value of d, such (d * e) % φ(n) = 1. (Note, in the formal the
“%” means “mod”, you can find it on the calculator. )
The plaintext M = 7
The process of encryption:
The cipher text C = Me (mod n) = _____________________
The process of decryption:
Cd (mod n) = ___________________ ====M