564 FadiFarhat Assignment3
564 FadiFarhat Assignment3
564 FadiFarhat Assignment3
Student name: Fadi Farhat Course name: Security and Privacy on the Internet
Instructor: Dr A. K. Aggarwal
Assignment 3
F A D I F A R H A T
7 6 68 73 70 6 82 72 65 84
0 5 5
70 + 65 + 68 + 73 + 70 + 65 + 82 + 72 + 65 + 84 = 714
Knowing that N = 23
714 mod 23 = 4
1+1=2
Perform encryption and decryption using the RSA algorithm, as in Figure 9.6, for the following:
1. p = 3; q = 11, e = 7; M = 5
2. p = 5; q = 11, e = 3; M = 9
3. p = 7; q = 11, e = 17; M = 8
4. p = 11; q = 13, e = 11; M = 7
5. p = 17; q = 31, e = 7; M = 2
Solution:
Encryption and decryption are of the following form, for some plaintext block M and ciphertext block C:
C = Me mod n
M = Cd mod n = (Me) d mod n = Med mod n
1. p = 3; q = 11, e = 7; M = 5
Knowing that:
-n=p*q
- C= Me mod n
C = 57 mod (33)
C = [(54 mod 33) * (52 mod 33) * (51 mod 33)] mod 33
C = (31 * 25 * 5) mod 33
C = 3875 mod 33
C = 14
The decryption will be:
Knowing that:
- M = Cd mod n = (Me) d mod n = Med mod n
- e and d are multiplicative inverses modulo (n), where (n) is the Euler totient function.
- d e1 (mod (n))
Course number: 60-564
Student name: Fadi Farhat Course name: Security and Privacy on the Internet
Instructor: Dr A. K. Aggarwal
(n) = (p –1) (q –1)
(n) = (3 -1) (11 –1) = 2 * 10 = 20
M = Cd mod n = 143 mod 33 = [(142 mod 33)*(141 mod 33)] mod 33 = 434 mod 33 = 5
M=5
The same rules will be applied for all the questions.
2. p = 5; q = 11, e = 3; M = 9
C = Me mod n
C = 93 mod 55
C = 729 mod 55
C = 14
(n) = 40
d = 27
Course number: 60-564
Student name: Fadi Farhat Course name: Security and Privacy on the Internet
Instructor: Dr A. K. Aggarwal
M = [(1416 mod 55) * (148 mod 55) * (142 mod 55) * (141 mod 55)] mod 55
M = [(144 mod 55) * (144 mod 55) * (144 mod 55) * (144 mod 55) * (144 mod 55) * (144 mod 55) * (142 mod 55) * (141
mod 55)] mod 55
M=9
3. p = 7; q = 11, e = 17; M = 8
C = Me mod n
C = 817 mod 77
C = [ (816 mod 77) * (81 mod 77) ] mod 77
C = [ (88 mod 77) * (88 mod 77) * (81 mod 77) ] mod 77
C = [(84 mod 77) * (84 mod 77) * (84 mod 77) * (84 mod 77) * (81 mod 77) ] mod 77
C = [(4096 mod 77) * (4096 mod 77) * (4096 mod 77) * (4096 mod 77) * (8 mod 77)] mod 77
C = [15 * 15 * 15 * 15 * 8] mod 77
C = [ 405000] mod 77
C = 57
(n) = 60
d = 53
M = Cd mod n = 5753 mod 77
M = [(5732 mod 77) * (5716 mod 77) * (574 mod 77) * (571 mod 77)] mod 77
574 mod 77 = 71
578 mod 77 = (71 * 71) mod 77 = 36
5716 mod 77 = (36 * 36) mod 77 = 64
M= (64 * 64 * 64 * 71 * 57) mod 77
M=8
C = Me mod n
C = 711 mod 143
C = [ (78 mod 143) * (72 mod 143) * (71 mod 143) ] mod 143
C = [(74 mod 143) * (74 mod 143) * (72 mod 143) * (71 mod 143) ] mod 143
C = (113 * 113 * 49 * 7) mod 143
C = (4379767) mod 143
C = 106
The decryption will be:
(n) = 120
Course number: 60-564
Student name: Fadi Farhat Course name: Security and Privacy on the Internet
Instructor: Dr A. K. Aggarwal
d = 11
M = Cd mod n = 10611 mod 143
M = [(1064 mod 143) * (1064 mod 143) * (1062 mod 143) * (1061 mod 143)] mod 143
M= (3*3*82*106) mod 143
M = 78228 mod 143
M=7
5. p = 17; q = 31, e = 7; M = 2
C = Me mod n
C = 27 mod 527
C = 128 mod 527
C = 128
The decryption will be:
(n) = 480
d = 343
M = Cd mod n = 128343 mod 527
M = [(128256 mod 527) * (12864 mod 527) * (12816 mod 527) * (1284 mod 527) * (1282 mod 527) * (1281 mod 527)]
mod 527
Course number: 60-564
Student name: Fadi Farhat Course name: Security and Privacy on the Internet
Instructor: Dr A. K. Aggarwal
M=2