Example 1
Watch presentation: [here]. [Link]
Let’s select:
P =11 Q=3 [Link] [Link]
The calculation of n and PHI is:
n=P × Q = 11 × 3 =33
PHI = (p-1) × (q-1) = 20
The factors of PHI are 1, 2, 4, 5, 10 and 20. Next the public exponent e is generated so that the greatest
common divisor of e and PHI is 1 (e is relatively prime with PHI). Thus, the smallest value for e is:
e=3
Next we can calculate d from:
(3 x d) mod (20) = 1 [Link]
Thus the smallest value of d will be:
d=7
Encryption key [33,3]
Decryption key [33,7]
Then, with a message of 4, we get:
Cipher = (m)e mod n
Cipher = (4)3 mod 33 = 31
Decoded = (cipher)d mod n
Decoded = 317 mod 33 = 4
Example 2
Let’s select (using the same P and Q, but we’ll pick a different e value):
P =11 Q=3 [Link] [Link]
The calculation of n and PHI is:
n=P × Q = 11 × 3 =33
PHI = (p-1)(q-1) = 20
We can select e as:
e=7
Next we can calculate d from:
7 x d mod (20) = 1 [Link]
d=3
Encryption key [33,7]
Decryption key [33,3]
Then, with a message of 2, we get:
Cipher = (2)7 mod 33 = 29
Decoded = 293 mod 33 = 2
Example 3
Let’s select:
P =13 Q=11 [Link] [Link]
The calculation of n and PHI is:
n=P × Q = 13 × 11 =143
PHI = (p-1)(q-1) = 120
We can select e as:
e=7
Next we can calculate d from:
(7 x d) mod (120) = 1 [Link]
d = 103
Encryption key [143,7]
Decryption key [143,103]
Then, with a message of 7, we get:
Cipher = (7)7 mod 143 = 6
Decoded = (6)103 mod 143 = 7
Example 4
Let’s select:
P =47 Q=71 [Link] [Link]
The calculation of n and PHI is:
n=P × Q = 13 × 11 = 3337
PHI = (p-1)(q-1) = 3220
We can select e as:
e = 79
Next we can calculate d from:
(79 × d) mod 3220 = 1 [Link]
d = 1019
Encryption key [3337,79]
Decryption key [3337,1019]
Then, with a message of 688, we get:
Cipher = (688)79 mod 3337 = 1570
Decoded = (1570)1019 mod 3337 = 688
Example 5
Let’s select:
P=23 Q=41 [Link] [Link]
The calculation of n and PHI is:
n=P×Q = 24×41 =943
PHI = (p-1)(q-1) = 880
We can select e as:
e=7
Next we can calculate d from:
(7 x d) mod 880 = 1 [Link]
d = 503
Encryption key [943,7]
Decryption key [943,503]
Then, with a message of 35, we get:
Cipher = (35)7 mod 943 = 545
Decoded = 545503 mod 943 = 35
Example 6
Let’s select:
P=61, Q=53 [Link] [Link]
The calculation of n and PHI is:
N = 61 x 53 = 3233
PHI = (P-1)(Q-1) = 3120
We can select e as:
e = 17
Next we can calculate d from:
(d x 17) mod (3120) = 1
d= 2753
Encryption key [3233,17]
Decryption key [3323,2753]
Then with a message of 65, we get:
Cipher = (65)17 mod 3233 = 2790
Decoded = 27902753 mod 3233 = 65
Example 7
Let’s select:
P=7, Q=13 [Link] [Link]
The calculation of n and PHI is:
N = 7 x 13 = 91
PHI = (P-1)(Q-1) = 72
We can select e as:
e=5
Next we can calculate d from:
(d x 5) mod (72) = 1
d= 29
Encryption key [91,5]
Decryption key [91,29]
Then with a message of 10, we get:
Cipher = (10)5 mod 91 = 82
Decoded = 8229 mod 91 = 10
n Prof Bill Buchanan, 2015