0% found this document useful (0 votes)
39 views4 pages

RAB 8ETRX DCE RSA Algorithm Examples

Uploaded by

Niharika Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views4 pages

RAB 8ETRX DCE RSA Algorithm Examples

Uploaded by

Niharika Dubey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Qu.

Perform encryption and decryption using the RSA algorithm for the following:
1. p=3; q=11; e=7; M=5
Answer:
n = p * q = 3 * 11 = 33
f(n) = (p-1) * (q-1) = 2 * 10 = 20
Now, we need to compute d = e-1 mod f(n) by using backward substitution of GCD
algorithm:
According to GCD:
20 = 7 * 2 + 6
7=6*1+1
6=1*6+0
Therefore, we have:
1=7–6
= 7 – (20 – 7 * 2)
= 7 – 20 + 7 * 2
= -20 + 7 * 3
-1 -1
Hence, we get d = e mod f(n) = e mod 20 = 3 mod 30 = 3
So, the public key is {7, 33} and the private key is {3, 33}, RSA encryption and
decryption is following:
Encryption Decryption
Plaintext ciphertext Plaintext
5 14 5

57 Mod 33= 14 143 Mod 33 = 5

PU= (7, 33) PR= (3, 33)


2. p=5; q=11; e=3; M=9
Answer:
n = p * q = 5 * 11 = 55
f(n) = (p-1) * (q-1) = 4 * 10 = 40
Now, we need to compute d = e-1 mod f(n) by using backward substitution of GCD
algorithm:
According to GCD:
40 = 3 * 13 + 1
13 = 1 * 13 + 0
Therefore, we have:
1 = 40 – 3 * 13
Hence, we get d = e mod f(n) = e mod 40 = -13 mod 40 = (27 – 40) mod 40 = 27
-1 -1

So, the public key is {3, 55} and the private key is {27, 55}, RSA encryption and
decryption is following:
Encryption Decryption
Plaintext ciphertext Plaintext
9 14 9

93 Mod 55= 14 1427 Mod 55 = 9

PU= (3, 55) PR= (27, 55)


3. p=7; q=11; e=17; M=8
Answer:
n = p * q = 7 * 11 = 77
f(n) = (p-1) * (q-1) = 6 * 10 = 60
Now, we need to compute d = e-1 mod f(n) by using backward substitution of GCD
algorithm:
According to GCD:
60 = 17 * 3 + 9
17 = 9 * 1 + 8
9=8*1+1
8=1*8+0
Therefore, we have:
1=9–8
= 9 – (17 – 9)
= 9 – (17 – (60 – 17 * 3))
= 60 – 17*3 – (17 – 60 + 17*3)
= 60 – 17 *3 + 60 – 17*4
= 60*2 – 17*7

Hence, we get d = e-1 mod f(n) = e-1 mod 60 = -7 mod 60 = (53-60) mod 60 = 53
So, the public key is {17, 77} and the private key is {53, 77}, RSA encryption and
decryption is following:

Encryption Decryption
Plaintext ciphertext Plaintext
8 57 8

817 Mod 77= 57 5753 Mod 77 = 8

PU= (17, 77) PR= (53, 77)

4. p=11; q=13; e=11; M=7


Answer:
n = p * q = 11 * 13 = 143
f(n) = (p-1) * (q-1) = 10 * 12 = 120
Now, we need to compute d = e-1 mod f(n) by using backward substitution of GCD
algorithm:
According to GCD:
120 = 11 * 10 + 10
11 = 10 * 1 + 1
10 = 1 * 10 + 0
Therefore, we have:
1 = 11 – 10
= 11 – (120 – 11 * 10)
= 11 – 120 + 11 * 10
= -120 + 11 * 11
Hence, we get d = e-1 mod f(n) = e-1 mod 120 = 11 mod 120 = 11
So, the public key is {11, 143} and the private key is {11, 143}, RSA encryption and
decryption is following:

Encryption Decryption
Plaintext ciphertext Plaintext
7 106 7

711 Mod 143 = 10611 Mod 143


106 =8

PU= (11, 143) PR= (11, 143)


5. p=17; q=31; e=7; M=2
n = p * q = 17 * 31 = 527
f(n) = (p-1) * (q-1) = 16 * 30 = 480
Now, we need to compute d = e-1 mod f(n) by using backward substitution of GCD
algorithm:
According to GCD:
480 = 7 * 68 + 4
7=4*1+3
4=3*1+1
3=1*3+0
Therefore, we have:
1=4–3
= 4 – (7 – 4)
= 4 – (7 – (480 – 7*68))
= 4 – (7 – 480 + 7*68)
= 480 – 7*68 – 7 + 480 – 7*68
= 480*2 – 7*137
Hence, we get d = e-1 mod f(n) = e-1 mod 480 = -137 mod 480 = (343 – 480) mod 480
=343
So, the public key is {7, 527} and the private key is {343, 527}, RSA encryption and
decryption is following:

Encryption Decryption
Plaintext ciphertext Plaintext
2 128 2

27 Mod 527 = 128343 Mod 527


128 =2

PU= (7, 527) PR= (343, 527)

You might also like