0% found this document useful (0 votes)
11 views18 pages

RSA Examples

Uploaded by

sameernsn
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)
11 views18 pages

RSA Examples

Uploaded by

sameernsn
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/ 18

Coordinator: Presintation by :

Dr. Ali Tahir Ms. Shouq Alrobaian


Encrypt & Decrypt using the RSA algorithm
for following:

a) P = 3 , q = 7 , e = 5 , m= 10

b) P = 5 , q = 13 , e = 5 , m= 8
a) P = 3 , q = 7 , e = 5 , m= 10
As per question, plaintext (M) = 10

Encrypted to generate ciphertext : me mod n


Calculate (n) = p x q = 3 x 7 = 21

ciphertext : me mod n = 10 5 mod 21 = 19


a) P = 3 , q = 7 , e = 5 , m= 10

!(n) = (p-1) x (q-1) = (3-1) x (7-1) = 2 x 6 = 12

e x d = 1 mod !(n)
e x d = 1 + (k x !(n))

1 + (k x !(n))
d=
"
* Calculate k until find Integer not decimal

1 + (k x &(n))
d=
'

1 + (1 x 12)
K= 1 d= = 2.5
!

1 + (2 x 12)
K= 2 d= =5
!
Ciphertext (C) = 19

Decryption to generate plaintext : cd mod n

= 19 5 mod 21 = 19
b) P = 5 , q = 13 , e = 5 , m= 8
As per question, plaintext (M) = 8

Encrypted to generate ciphertext : me mod n


Calculate (n) = p x q= 5 x 13 = 65

ciphertext : me mod n = 8 5 mod 65 = 8


b) P = 5 , q = 13 , e = 5 , m= 8

!(n) = (p-1) x (q-1)= (5-1) x (13-1) = 4 x 12 = 48

e x d = 1 mod !(n)
e x d = 1 + (k x !(n))

1 + (k x !(n))
d=
"
* Calculate k until find Integer not decimal

1 + (k x ((n))
d=
)

1 + (1 x 48) #$
K= 1 d= = = 9.8
! !

1 + (2 x 48) $*
K= 2 d= !
= !
= 19.4

1 + (3 x 48) -#!
K= 3 d= = = 29
! !
Ciphertext (C) = 8

Decryption to generate plaintext : cd mod n


= 8 29 mod 65
= (8 2 mod 65) (8 4 mod 65) (8 8 mod 65) (8 15 mod 65)

(64) (1) ((8 4 mod 65) (8 4 mod 65))

(1) (1)

(1)

= (8 2 mod 65) (8 4 mod 65) (8 8 mod 65) (8 mod 65)


( 64 1 1 8) mod 65 = 57
Ciphertext (C) = 8

Decryption to generate plaintext : cd mod n

= 8 29 mod 65 = ( 64 x 1 x 1 x 57 ) mod 65 = 8
A public- key system RSA, you intercept the
ciphertext c = 20 sent to a user where public key
is e = 13 , n = 77 , what is the plaintext m =?
First we should discover the p & q from (n) value where = 77

(n) = p x q = 77 So p = 7 & q= 11
!(n) = (p-1) x (q-1)= (7-1) x (11-1) = 6 x 10 = 60

e x d = 1 mod !(n)
e x d = 1 + (k x !(n))

1 + (k x !(n))
d=
"
* Calculate k until find Integer not decimal

1 + (k x )(n))
d=
*
1 + (1 x 60) $!
K= 1 d= = = 4.69
!" !"

1 + (2 x 60) !+!
K= 2 d= !"
= !"
= 9.30

1 + (3 x 60) !.!
K= 3 d= = = 13.92
!" !"

1 + (4 x 60) +1!
K= 4 d= = = 18.53
!" !"
…………

1 + (8 x 60) 1.!
K= 8 d= = = 37
!" !"
Ciphertext (C) = 20

Decryption to generate plaintext : 2037 mod 77 = 48

You might also like