Professional Documents
Culture Documents
generate her public and private keys. If the public key of Ais 35. Then the private key of
A is ____________.
Answer: (A)
(e * d) mod ϕ(n) = 1
Where,
RSA Example
•p = 11, q = 7, n = 77, Φ(n) = 60
M ≡ 7113(mod 77) = 15
A and B decide to use Diffie Hellman algorithm to share a key. They chose p=23 and g-5
as the public parameters. Their secret keys are 6 and 15 respectively. Compute the
secret key that they share
Ans:
s = 196 mod 23 = 2
s = 815 mod 23 = 2
1. In RSA system public key of a given user e=7 & n=187. [10]
What is the private key of this user?
If the intercepted CT=11 and sent to a user whose public key e=7 &
n=187. What is the PT?
Elaborate various kinds of attacks on RSA algorithm?
•Let us compute d: de=1 mod 160 , d=23 (in fact, 23x7=161 = 1 mod 160
•Secret key = 23
Question 9.3:
In a public-key system using RSA, you intercept the ciphertext C =10 sent to a user whose
public key is e=5, n=35. What is the plaintext M?
Solution:
We know that the ciphertext C = 10, and the public key PU = {e, n} = {5, 35}.
Based on Euler’s Totient function, (n) is defined as the number of positive integers less
than n and relatively prime to n [textbook: “Cryptography and Network Security”, page 240].
We could find that (n) = 24.
Now, we guess two prime numbers p and q. Let p be 5 and q be 7. All the following
conditions will be satisfied based on the guess:
ed ≡ 1 mod (n)
or ed mod (n) =1. (chapter 9.1 page 269)
We also can verify the correctness by the RSA encryption algorithm as the following:
C = Me mod n = 55 mod 35 = 10
2 x 2 Example
To perform matrix multiplication we "combine" the top row of the key matrix with the
column vector to get the top element of the resulting column vector. We then "combine" the
bottom row of the key matrix with the column vector to get the bottom element of the
resulting column vector. The way we "combine" the four numbers to get a single number is
that we multiply the first element of the key matrix row by the top element of the column
vector, and multiply the second element of the key matrix row by the bottom element of the
column vector. We then add together these two answers.
Next we have to take each of these numbers, in our resultant column vector, modulo 26
(remember that means divide by 26 and take the remainder).
The whole calculation: converting to numbers; the matrix multiplication; reducing modulo 26;
converting back to letters.
matrix.
Steps:
To turn the keyword into a matrix, if the keyword was longer than the 4 letters needed, we
would only take the first 4 letters and if it was shorter, we would fill it up with the alphabet in
order.
=[HLIL]
With the keyword in a matrix, we need to convert this into a key matrix. We do this by
converting each letter into a number by its position in the alphabet (starting at 0), So, A = 0,
B = 1, C = 2, D = 3, etc.
=[711811]
Now, we split the plain text into digraphs and write these as column vectors, that is the first
column vector we write the first plain text letter at the top and the second letter at the bottom.
Then we move to the next column vector, where the third plain text letter goes at the top and
the fourth at the bottom. This continues for the whole plain-text.
[sh][or][te][xa][mp][le]
The plain text “short example” split into the column vectors.
Now, we convert the plain text column vectors in the same way that we converted the
keyword into the key matrix. Each letter is replaced by its appropriate number.
[187][1417][194][230][1215][1104]
Next step is to perform matrix multiplication. We multiply the key matrix by each column
vector in turn. We write the key matrix first, followed by the column vector.
Finally, we have to convert these numbers back to letters, so ‘o’ becomes ‘A’ and ‘15’
becomes ‘p’ and our first two letters of the ciphertext are AP
Thus,
Follow the same procedure for the next column vectors of plain text.
Decryption:
Key = k = [HLIL]
= [711811]=11×7−88
= - 11 mod 26
D = 15
We want 1D
⇒ k−1=[2512223]
Follow the same procedure for the next column vectors of ciphertext.
https://www.ques10.com/p/48148/to-encrypt-a-message-using-the-hill-cipher-1/
https://www.practicalnetworking.net/series/cryptography/rsa-example/
https://www.cemc.uwaterloo.ca/resources/real-world/RSA.pdf