100% found this document useful (1 vote)
149 views

Rsa Examples

The document provides an example of encrypting a message using RSA with a modulus of 2537 and an encryption exponent of 13. It translates the message "ATTACK" into integers by representing each letter as a 2-digit number. It then encrypts each pair of integers by computing the cipher text as the plaintext to the power of 13 modulo 2537. The resulting cipher text is 067415371643.

Uploaded by

marshadjafer
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
100% found this document useful (1 vote)
149 views

Rsa Examples

The document provides an example of encrypting a message using RSA with a modulus of 2537 and an encryption exponent of 13. It translates the message "ATTACK" into integers by representing each letter as a 2-digit number. It then encrypts each pair of integers by computing the cipher text as the plaintext to the power of 13 modulo 2537. The resulting cipher text is 067415371643.

Uploaded by

marshadjafer
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/ 3

RSA-EXAMPLES

EXAMPLE : For the RSA system p = 11 , q = 17 and e = 7


(a) Encrypt the message ' DO '
modulus is n = p*q = 11*17 = 187 and ϕ(n)=( p−1)(q−1)=10.16=160
Encryption Scheme is
e
C=M mod n
=> C=M 7 mod 187
We encrypt the message ' DO '
Here M = ' DO ' D = 03 and O = 14 So M = ' DO ' = 0314 = 314
Then
C=M 7 mod 181=3147 mod 187 Use FME
The binary form of 7 is 2 | 7 7 = (111) 2=2 2+2 1+20 =4+2+1
2 | 3 --- 1
| 1 --- 1
7 (4+2+1)
C=314 mod 187=314 mod 187
4 2
= 314 .314 .314 mod 187
Using repeated squaring
=> 3142 =98596 mod 187=47
=> 3144 =(314 2) 2=(47)2=2209 mod 187=152

=> C=314 4 .314 2 .314 1 mod 187 = 152.47.314 mod 187 = 7144.314 mod 187
=> C=38.314 mod 187=11932 mod 187 => C=151
(b) Decrypt the cipher ' EN '
Here C = ' EN ' As E = 04 and N = 13 So
C = 0413 = 413
Decryption Scheme is
M =C d mod n
=> M =413d mod 187
We need to find the decryption exponent d
d is the inverse of e =7 in mod ϕ(n)=( p−1)(q−1)=10.16=160 So we find it using extended
Euclidean Algorithm , inverse of 7 modulo 160 is
160 = 7(22) + 6 -----------> (1)
7 = 6(1) + 1 ------------->(2)
6 = 1(6)
As gcd( 160 , 7 ) = 1 so inverse of 7 in modulo 160 exists
Now find Bezout's co-efficient of 7
From ( 2 ) above => 1 = 7 - 6(1)=7 – [160 - 7(22)](1) from (1)
=> 1 = 7 – 160 +7(22) = 7(23)-160
So inverse of 7 modulo 160 is 23 => d = 23
Then Decryption Scheme is
M =41323 mod 187 Use FME
The binary form of 23 is
2 | 23 23 = (10111) 2=2 4+2 2+21+2 0=16+4+2+1
2 | 11 --- 1
2 | 5 --- 1
2 | 2 --- 1
| 1 --- 0
M =41323 mod 187=413(16+4+2+1) mod 187
= 41316 .4134 . 4132 .4131 mod 187
Using repeated squaring
=> 413 2=170569 mod 187=25
=> 413 4=( 4132 )2=(25)2=625 mod 187=64
=> 4138=( 4134) 2=(64)2 =4096 mod 187=169
=> 41316=(4138 )2=(169) 2=28561 mod 187=137
Then
16 4 2 1
M =413 .413 . 413 .413 mod 187=137.64 .25 .413 mod 187
= 8768.10325 mod 187=166.40 mod 187=6640 mod 187
=> M =95

---------------------------------------------------------------------------------------------------------------------------------------
EXCERCISE ON PAGE # 304

Q # 24 : Encrypt the message ATTACK using the RSA system with n = 43.59 = 2537 and e = 13,
translating each letter into integers and grouping together pairs of integers.
As n = 43.59 so two large primes are p = 43 and q = 59.We find Encryption Scheme
e
C=M mod n
=> C=M 13 mod 2537
We translate ' ATTACK ' into Z 26 using two digits for each letter so ' ATTACK ' = 001919000210
[ Remember A = 00 , T = 19 , C = 02 , K = 10 ].
We group together pair of integers : 0019 1900 0210
These are values of our message M
First we encrypt M = 0019 = 19
C=M 13 mod 2537 = 1913 mod 2537 Use FME
The binary form of 13 is 2 | 13 13 = (1101) 2=2 3+2 2+20 =8+4+1
2 | 6 --- 1
2 | 3 --- 0
| 1 --- 1

13 (8+ 4+1 )
C=19 mod 2537=19 mod 2537
8 4
= 19 .19 .19 mod 2537
Using repeated squaring
=> 192=361 mod 2537=361
=> 194=(192 )2=(361)2=130321 mod 2537=934
=> 198=(194 )2=( 934) 2=872356 mod 2537=2165
=> C=198 .192 .191 mod 2537 = 2165.361 .19 mod 2537 = 781565.19 mod 2537
=> C=169.19 mod 2537=3211 mod 2537 => C=674
Similarly for M = 1900
C=M 13 mod 2537
13 (8+4+1)
C=1900 mod 2537=1900 mod 2537
= 19008 .1900 4 .1900 mod 2537
Using repeated squaring
=> 19002=3610000 mod 2537=2386
=> 19004 =(1900 2)2=(2386)2 =5692996 mod 2537=2505
=> 19008=(19004 )2=(2505)2=6275025 mod 2537=1024
=> C=19008 .19002 .19001 mod 2537 = 1024.2386 .1900 mod 2537
= 2443264.1900 mod 2537
=> C=133.1900 mod 2537=252700 mod 2537 => C=1537
For M = 0210 = 210
C=M 13 mod 2537
C=190013 mod 2537=1900(8+4+1) mod 2537
= 2108 .2104 . 210 mod 2537
Using repeated squaring
=> 210 2=44100 mod 2537=971
=> 210 4=(210 2)2=(971)2=942841 mod 2537=1614
=> 2108 =( 2104 )2=(1614) 2=2604996 mod 2537=2034
=> C=2108 .210 2 .210 1 mod 2537 = 2034.971 .210 mod 2537
= 1975014.210 mod 2537
=> C=1228.210 mod 2537=257880 mod 2537 => C=1643
Therefore ' ATTACK ' = 0019190002 is encrypted into 067415371643

You might also like