MODULE III Question
MODULE III Question
ASSIGNMENT QUESTIONS
Steps in Diffie-Hellman:
1. Public Parameters:
- Two public values are agreed upon: a large prime number ( p ) and a base ( g ) (also called
a generator), where ( 1 < g < p ).
- These values are shared publicly between the communicating parties (typically Alice and
Bob).
Thus, ( S_A = S_B = g^{ab} mod p ) becomes their shared secret key.
1
QUESTION : Define Hash Algorithm and Properties
2
QUESTION : Differentiate Message Authentication Code and Hash Function
ANSWER:
2. Encryption:
- The sender chooses a random ( k ), computes ( c_1 = g^k mod p ), and ( c_2 = m cdot y^k
mod p ), where ( m ) is the plaintext message.
- The ciphertext is ( (c_1, c_2) ).
3
3. Decryption:
- The receiver uses their private key ( x ) to compute ( m = c_2 / (c_1^x mod p) mod p ).
Steps in RSA:
1. Key Generation:
- Choose two large prime numbers ( p ) and ( q ).
- Compute ( n = p times q ).
- Compute Euler's Totient ( phi(n) = (p - 1) times (q - 1) ).
- Choose a public exponent ( e ), such that ( 1 < e < phi(n) ) and ( gcd(e, phi(n)) = 1 ).
- Compute the private key ( d ) such that ( d times e equiv 1 mod phi(n) ).
2. Encryption:
- To encrypt a message ( m ), the sender computes the ciphertext ( c = m^e mod n ).
3. Decryption:
- The recipient decrypts the ciphertext ( c ) using the private key ( d ), computing ( m = c^d
mod n ).
ANSWER: A primitive root of a prime number ( p ) is any integer ( g ) such that the powers
of ( g ) generate all the integers from 1 to ( p-1 ) under modulo ( p ). In other words, ( g ) is a
generator of the multiplicative group modulo ( p ).
Example:
Let ( p = 7 ).
4
The numbers 1 through ( p-1 ) are: ( 1, 2, 3, 4, 5, 6 ).
Let’s test ( g = 3 ):
- ( 3^1 mod 7 = 3 )
- ( 3^2 mod 7 = 9 mod 7 = 2 )
- ( 3^3 mod 7 = 27 mod 7 = 6 )
- ( 3^4 mod 7 = 81 mod 7 = 4 )
- ( 3^5 mod 7 = 243 mod 7 = 5 )
- ( 3^6 mod 7 = 729 mod 7 = 1 )
Question : User Alice & Bob exchange the key using Diffie Hellman algorithm. Assume α =
5, q = 83, XA = 6, XB = 10. Find YA, YB, K.
Answer: In the Diffie-Hellman key exchange algorithm, the two parties, Alice and Bob,
compute the shared secret key as follows:
Given:
- ( alpha = 5 ) (the base or generator)
- ( q = 83 ) (a prime number)
- ( X_A = 6 ) (Alice’s private key)
- ( X_B = 10 ) (Bob’s private key)
5
- Bob computes the shared key ( K_B ):
K_B = Y_A^{X_B} mod q = 61^{10} mod 83 = 61
Thus, the shared key ( K = 61 ).
Question : Perform encryption and decryption using RSA Algorithm for the following: P =
17, q = 11, e = 7, M = 88.
Answer: The RSA algorithm involves key generation, encryption, and decryption.
Step 1: Calculate modulus ( N ) and Euler’s totient function ( phi(N) )
- ( N = P times q = 17 times 11 = 187 )
- ( phi(N) = (P-1)(q-1) = (17-1)(11-1) = 16 times 10 = 160 )
Step 3: Encryption
The ciphertext ( C ) is calculated as:
Step 4: Decryption
To decrypt, calculate:
M = C^d mod N = 11^{23} mod 187 = 88
6
So, the original message ( M = 88 ).
Question : Elaborate the steps of key generation using RSA algorithm. In the RSA system,
the public key (E, N) of user A is defined as (7,187). Calculate ( phi(N) ) and private key
( D ). What is the cipher text for M = 10 using the public key?
Answer:
Step 1: Calculate ( phi(N) )
- ( N = 187 ) implies that the prime factors of 187 are ( P = 17 ) and ( q = 11 ).
- ( phi(N) = (P-1)(q-1) = (17-1)(11-1) = 16 times 10 = 160 ).
Step 3: Encryption
For ( M = 10 ), the ciphertext ( C ) is calculated as:
C = M^E mod N = 10^7 mod 187 = 131
So, the ciphertext ( C = 131 ).
Question : In RSA system, the public key of a given user is e = 7 and n = 187:
1) Predict the private key of this user?
2) If the intercepted ciphertext ( CT = 11 ) is sent to a user whose public key ( e = 7 ) and ( n
= 187 ), specify the plaintext ( PT ).
Answer:
1. Private key prediction:
As calculated earlier, the private key ( d = 23 ).
2. Decryption of ciphertext ( CT = 11 ):
Using the private key ( d = 23 ): PT = CT^d mod N = 11^{23} mod 187 = 88
7
So, the plaintext is ( PT = 88 ).
Question : Describe the role of compression function in hash function?
Answer: The Elgamal algorithm consists of three main steps: key generation, encryption, and
decryption.
1. Key Generation:
- Choose a large prime ( p ) and a generator ( g ) in ( Z_p^* ).
- Choose a private key ( x ), where ( 1 leq x leq p-2 ).
- Compute the public key ( y = g^x mod p ).
- The public key is ( (p, g, y) ), and the private key is ( x ).
2. Encryption:
- To encrypt a message ( M ):
- Choose a random integer ( k ), where ( 1 leq k leq p-2 ).
- Compute ( c_1 = g^k mod p ) and ( c_2 = M times y^k mod p ).
- The ciphertext is ( (c_1, c_2) ).
3. Decryption:
- To decrypt the ciphertext ( (c_1, c_2) ):
- Compute ( s = c_1^x mod p ).
- Compute ( M = c_2 times s^{-1} mod p ), where ( s^{-1} ) is the modular inverse of ( s ).
8
9