Diffie–Hellman key exchange
Agreeing on a secret… while talking in front of everyone

GFDL — Wikimedia Commons
In brief
In 1976, Whitfield Diffie and Martin Hellman of Stanford University published a revolutionary idea: two people who have never met can build a shared secret key by exchanging only public messages. It was the birth of public-key cryptography, which protects the internet today.
The story
Encryption had always required both correspondents to share a key first, delivered by a messenger or at a meeting. Diffie and Hellman, helped by the work of Ralph Merkle, showed that some calculations are easy in one direction but almost impossible to undo. Each person keeps a secret number, sends the other the result of a calculation, then combines what they receive with their secret: both arrive at the same number, which a spy cannot work out.
Their paper, “New Directions in Cryptography”, came out in November 1976. In 1997 it emerged that researchers at the British GCHQ, James Ellis, Clifford Cocks and Malcolm Williamson, had made similar discoveries a few years earlier, kept secret. Diffie and Hellman received the 2015 Turing Award, the highest honour in computing.
Example
Like with paint: start from a shared colour, each adds a secret colour, swap the mixtures, then each adds their secret colour again. Both get the same shade.
Did you know?
Every time you see a padlock in your browser’s address bar, a modern version of this key exchange has just taken place.
Sources: D. Kahn, The Codebreakers, 1967 (rev. ed. 1996); S. Singh, The Code Book, 1999; F. L. Bauer, Decrypted Secrets, 4th ed., 2007; C. P. Bauer, Secret History: The Story of Cryptology, 2nd ed., 2021; texts written for this site.
Passwords
DES
RSA
Quantum cryptography
PGP
The web padlock (HTTPS)
AES
End-to-end encryption