Applied Cryptography
Diffie–Hellman key exchange is checked with small numbers. Let p = 23 and g = 5; A chooses the secret value a = 6 and B the secret value b = 15. A sends A = g^a mod p and B sends B = g^b mod p. Which of the following is the shared secret the two obtain?
- A2
- B8
- C14
Show answer and explanation
Answer: A. 2
A = 5^6 mod 23 = 15625 mod 23 = 8 and B = 5^15 mod 23 = 19. A computes B^a = 19^6 mod 23 = 2 from B's value and B computes A^b = 8^15 mod 23 = 2 from A's value, and both get the same value 2. This is because both equal g^(ab) = 5^90 mod 23. An eavesdropper sees only p, g, A = 8 and B = 19, and to get 2 from these must find a or b.
- A. Correct. 19^6 mod 23 = 8^15 mod 23 = 2.
- B. 8 is A = 5^6 mod 23, the public value that A sends.
- C. 14 is A × B mod 23 = 152 mod 23, the product of the public values. An eavesdropper can compute it too, so it cannot be the shared secret.