Use p 5 q 7 and e 5 in the RSA cryptography system Encode
Solution
5. We are given p = 5, q = 7 and e = 5 for the RSA cryptolgraphy.
To encode a message using the RSA code follow the steps below:
1) Choose prime numbers p and q (here we are given p=5 and q=7)
2) We multiply these 2 numbers together (7×5 = 35). This is the public key (m), So m = 35.
3) Now we need to use an encryption key (e). Here we are given that e = 5.
( e must actually be relatively prime to (p-1)(q-1) )
4) Now we are ready to encode something.
First we can assign 00 = A, 01 = B, 02 = C, 03 = D, 04 = E etc. all the way to 25 = Z.
5) We now use the formula: C = ye (mod m) where y is the letter we want to encode.
Here we have m = pq = 7 x 5 = 35 so we use (mod 35) for encoding
Note : (mod 35 simply mean we look at the remainder when we divide by 35).
a) So for the letters RIENHARDT, we encode each alphbet as follows
R = 175 = 1419857 (mod 35) which is equivalent to 12
E = 045 = 1024 (mod 35) which is equivalent to 09
I = 085 = 32768 (mod 35) which is equivalent to 08
N = 135 = 371293 (mod 35) which is equivalent to 13
H = 075 = 16807 (mod 35) which is equivalent to 07
A = 005 = 0 (mod 35) which is equivalent to 00
R = 175 = 1419857 (mod 35) which is equivalent to 12
D = 035 = 243 (mod 35) which is equivalent to 33
T = 195 = 2476099 (mod 35) which is equivalent to 24
So the word \"REINHARDT\" encoded to \"10 09 08 13 07 00 12 33 24\" .
------------------------------------------------------------------------------------------------------------------------------------
b) Now we have to find inverse of 5 mod 24, we are given (p-1)(q-1) = 24
In this RSA encryption we are given both m and e. These are public keys. We are given that m = 35
and e = 5. We need to find the two prime numbers that multiply to give 35. These are p = 7 and q = 5.
Calculate (p-1)(q-1). In this case this it is (7-1)(5-1) = 24. Call this number theta.
Calculate a value \"d\" such that d x e = 1 (mod theta). We already know that e is 5.
Therefore we want 5d = 1 (mod 24). Clearly when d = 5 we have 5×5 = 25 which is 1 (mod 24).
So the inverse of 5 (mod) 24 has given decryption key d = 5.
That means we can now use this decryption key d = 5 to decode or decipher.
--------------------------------------------------------------------------------------------------------------------------------------------------------
c) Decode 10 1 7 17 10 24
To decipher this code we need to follow the steps given below.
Now we can decipher using the formula: y = C^d (mod m),
Where, C is the codeword, m = 35 and d = 5. (d = deciper key =5 that we got in part b).
So for the cipher text 10 1 7 17 10 24 can be written as
For 10 : y = 105 = 100000 (mod 35) = 05.
For 1 : y = 15 = 01 (mod 35) = 01.
For 7 : y = 75 = 16807 (mod 35) = 07.
For 17 : y = 175 = 1419857 (mod 35) = 12.
For 10 : y = 105 = 100000 (mod 35) = 05.
For 24 : y = 245 = 7962624 (mod 35) = 19.
We can now convert these numbers back to letters using A = 00, B = 01 etc. all the way Z=25.
05 01 07 12 05 19
F B H M F T
This gives the decoded word as: \"FBHMFT\"

