- 2074 Asoj · 4 marks
Short note: Diffie-Hellman
Short answer
Diffie-Hellman enables two parties to establish a shared secret over an insecure channel without prior meeting. They agree on a large prime p and generator g, exchange public values g^a mod p and g^b mod p, then compute the shared key g^ab mod p. Security depends on the discrete logarithm problem. It lacks authentication and is vulnerable to man-in-the-middle attacks unless combined with digital signatures or certificates.
Write a short note on Diffie Hellman's algorithm.
The Diffie-Hellman (DH) algorithm (1976) lets two parties agree on a shared secret key over an insecure channel without having met before. It is a key-exchange method, not an encryption method. Its security depends on the difficulty of the discrete logarithm problem.
Steps
- Alice and Bob publicly agree on a large prime p and a generator (primitive root) g.
- Alice chooses a secret a and sends A = gᵃ mod p. Bob chooses a secret b and sends B = gᵇ mod p.
- Alice computes K = Bᵃ mod p; Bob computes K = Aᵇ mod p.
- Both get the same K = gᵃᵇ mod p, used as the symmetric session key.
Example
p = 23, g = 5, Alice's secret a = 6, Bob's secret b = 15.
| Step | Alice | Bob |
|---|---|---|
| Public value | A = 5⁶ mod 23 = 8 | B = 5¹⁵ mod 23 = 19 |
| Exchange | sends 8 | sends 19 |
| Shared key | 19⁶ mod 23 = 2 | 8¹⁵ mod 23 = 2 |
Shared key K = 2. An eavesdropper sees p, g, 8 and 19, but cannot easily find a or b for large p.
Weakness
It does not authenticate the parties, so it is open to a man-in-the-middle attack; digital signatures or certificates are used to prevent it. It is used in IPsec (IKE) and SSL/TLS.
✓ Answer checked by Claude Opus 5.5 (high effort)