Cryptography / Public-key cryptography
Diffie–Hellman Key Exchange
Two strangers agree on a shared secret over a channel everyone can hear.
Contents 3 sections
By the end you can
- Run the Diffie–Hellman protocol with small numbers
- Explain the discrete logarithm problem
- Recognise the man-in-the-middle risk
Helps to know: Substitution and Shift Ciphers
§1The protocol
Alice and Bob publicly agree on a prime and a base . Alice picks a secret and sends . Bob picks a secret and sends . Each can now compute the same number:
Example 1Small numbers
- , . Alice picks : .
§2Why eavesdroppers are stuck
An eavesdropper sees , , and . Recovering from is the discrete logarithm problem, for which no efficient algorithm is known when has hundreds of digits.
Check yourself
- Q1Which value is never sent over the network in Diffie–Hellman?