0% found this document useful (0 votes)
49 views9 pages

MODULE III Question

Uploaded by

Abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views9 pages

MODULE III Question

Uploaded by

Abhi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

MODULE III

ASSIGNMENT QUESTIONS

QUESTION : Describe Diffie-Hellman Algorithm


ANSWER: The Diffie-Hellman algorithm is a method used to securely exchange
cryptographic keys over a public channel. It allows two parties to create a shared secret key
that can be used for subsequent encryption, even though their communication is visible to
third parties. This key exchange is fundamental to many cryptographic protocols and serves
as the basis for modern key-agreement protocols.

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).

2. Private Key Selection:


- Alice chooses a private number ( a ) and Bob chooses a private number ( b ). These private
values are kept secret.

3. Public Key Calculation:


- Alice computes her public key as ( A = g^a mod p ) and sends it to Bob.
- Bob computes his public key as ( B = g^b mod p ) and sends it to Alice.

4. Shared Secret Calculation:


- Alice calculates ( S_A = B^a mod p ), which is equivalent to ( g^{ba} mod p ).
- Bob calculates ( S_B = A^b mod p ), which is also equivalent to ( g^{ab} mod p ).

Thus, ( S_A = S_B = g^{ab} mod p ) becomes their shared secret key.

1
QUESTION : Define Hash Algorithm and Properties

ANSWER: A hash algorithm is a cryptographic function that transforms an input (or


message) of any length into a fixed-size string, known as the hash value or digest. Hash
algorithms are widely used in security protocols for tasks such as data integrity verification,
password storage, and digital signatures.

Properties of a Hash Algorithm:


1. Deterministic: For any given input, the output will always be the same.
2. Fixed Output Size: Regardless of the input size, the hash output always has a fixed length
(e.g., 256 bits for SHA-256).
3. Fast to Compute: The hash value can be computed efficiently for any input.
4. Pre-image Resistance: It is computationally infeasible to reverse a hash value to find the
original input.
5. Collision Resistance: It is hard to find two distinct inputs that produce the same hash
output.
6. Avalanche Effect: A small change in the input leads to a drastically different hash output.

QUESTION : Describe Message Authentication Code

ANSWER: A Message Authentication Code (MAC) is a cryptographic checksum that


provides message integrity and authenticity. It is generated using a cryptographic algorithm
that takes a message and a secret key as inputs and outputs a MAC. The MAC is appended to
the message and sent to the receiver, who can verify both the message's integrity and
authenticity by recalculating the MAC using the same secret key.

Steps for MAC:


1. The sender applies a cryptographic function (e.g., a hash function or block cipher) to the
message using a secret key to generate the MAC.
2. The MAC is sent alongside the message to the recipient.
3. The recipient, using the same secret key, recalculates the MAC from the received message
and compares it to the transmitted MAC.
4. If both MACs match, the message is verified as authentic and unaltered.

2
QUESTION : Differentiate Message Authentication Code and Hash Function

ANSWER:

QUESTION : Define Elgamal Cryptosystem

ANSWER: The Elgamal Cryptosystem is an asymmetric encryption algorithm used for


secure communication. It is based on the Diffie-Hellman key exchange mechanism and relies
on the difficulty of solving the discrete logarithm problem. Elgamal can be used for both
encryption and digital signatures.

Components of Elgamal Cryptosystem:


1. Public Key:
- A large prime number ( p ), a generator ( g ), and a public key ( y = g^x mod p ), where ( x
) is the private key.

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 ).

QUESTION : Explain the Procedure for RSA Cryptosystem

ANSWER: The RSA Cryptosystem is a widely-used public-key encryption and digital


signature algorithm that relies on the mathematical difficulty of factoring large composite
numbers.

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) ).

The public key is ( (e, n) ), and the private key is ( (d, 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 ).

QUESTION: Define Primitive Root of a Prime Number with Example

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 )

Since the powers of 3 generate all numbers from 1 to 6, ( 3 ) is a primitive root of ( 7 ).

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)

Step 1: Calculate public keys


1. Alice’s public key ( Y_A ):
Y_A = alpha^{X_A} mod q = 5^6 mod 83 = 15625 mod 83 = 61

2. Bob’s public key ( Y_B ):


Y_B = alpha^{X_B} mod q = 5^{10} mod 83 = 9765625 mod 83 = 62

Step 2: Calculate shared secret key ( K )


- Alice computes the shared key ( K_A ):
K_A = Y_B^{X_A} mod q = 62^6 mod 83 = 61

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 2: Public key and private key


- The public key is ( (e, N) = (7, 187) ).
- To find the private key ( d ), we need to solve ( e times d equiv 1 mod phi(N) ).

We solve for ( d ) using the extended Euclidean algorithm:


- ( 7 times d equiv 1 mod 160 )
- ( d = 23 ), since ( 7 times 23 = 161 ) and ( 161 mod 160 = 1 ).

Thus, the private key is ( d = 23 ).

Step 3: Encryption
The ciphertext ( C ) is calculated as:

C = M^e mod N = 88^7 mod 187


88^7 mod 187 = 11 quad (text{after reduction})
So, the ciphertext ( C = 11 ).

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 2: Calculate private key ( D )


We need to find ( d ) such that:

E times D equiv 1 mod phi(N) = 7 times D equiv 1 mod 160

Using the extended Euclidean algorithm, ( D = 23 ).

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 compression function is a critical component in hash functions. It takes an


input of fixed length and produces a smaller, fixed-size output, typically in the form of a hash
value or digest. The main roles of a compression function are:
1. Reduce input size: It compresses a large block of data into a smaller fixed-size hash.
2. Increase efficiency: It allows hash functions to work on large messages by processing them
in blocks.
3. Ensure security: The function should be collision-resistant, meaning no two distinct inputs
should produce the same hash output.
4. Iterative process: It operates in an iterative manner on each block of the message to
generate a final digest.

Question : Describe the steps involved in Elgamal algorithm.

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

You might also like