On this page
For most of history, two people who wanted to send coded messages had to meet first, or trust a courier, to share the secret key. Whitfield Diffie and Martin Hellman found a way round that. This post explains who they were, how their key exchange works with numbers small enough to check by hand, and what a student can borrow from the way they worked.
What problem were Diffie and Hellman trying to solve?
The ACM announcement of the 2015 Turing Award puts it plainly. In older systems both parties needed identical keys, and supplying those keys safely, called key management, was a major limit on encrypted communication. If a bank wants to talk privately with millions of customers, it cannot post a sealed key to each of them before every session.
Their 1976 paper, New Directions in Cryptography, in IEEE Transactions on Information Theory, opens with the line "We stand today on the brink of a revolution in cryptography." Its abstract states the goal: systems that "minimize the need for secure key distribution channels and supply the equivalent of a written signature."
Who were Whitfield Diffie and Martin Hellman?
According to his ACM Turing Award biography, Diffie was born in 1944 in Washington, D.C., read books on cryptography as a boy, and completed a B.S. in mathematics at MIT in 1965. Reading David Kahn's history The Codebreakers pushed him to study cryptography on his own. In the autumn of 1974 he asked to meet Hellman; the short meeting ran through dinner and late into the evening.
Hellman's Turing biography records that he was born in 1945, grew up in the Bronx, studied electrical engineering at New York University and earned his PhD at Stanford in 1969. Lunches with the cryptographer Horst Feistel at IBM taught him that problems that sounded unsolvable could sometimes be solved quickly.
The same biographies credit Ralph Merkle, then a student at Berkeley, with an earlier idea for public key distribution, now called Merkle's puzzles. Diffie and Hellman cited his work, and Hellman later argued that the credit should be shared as Diffie-Hellman-Merkle.
How does the key exchange work?
The paper uses a large prime q and a fixed number α. Each user picks a secret number X and publishes Y = α^X mod q. When users i and j want to talk, each raises the other's public number to their own secret power. Both arrive at the same key, K = α^(XiXj) mod q, without ever sending it.
An eavesdropper sees α, q and both public numbers. To get the key, they would need to recover a secret exponent from Y, a problem called the discrete logarithm. The paper gives the scale of the gap: with numbers about 200 bits long, a user needs at most 400 multiplications, while taking logarithms by the method then known would need about 2^100, or roughly 10^30, operations.
Worked example: a key exchange you can check by hand
Take a toy prime q = 23 and base α = 5. Alice picks the secret a = 6; Bob picks b = 15.
Alice's public number: 5^6 mod 23. Reduce as you go: 5^2 = 25 ≡ 2, so 5^4 ≡ 4 and 5^6 ≡ 4 × 2 = 8. Alice sends 8.
Bob's public number: 5^15 = 5^8 × 5^4 × 5^2 × 5. With 5^8 ≡ 16, this is 16 × 4 × 2 × 5 = 640 ≡ 19 (since 23 × 27 = 621). Bob sends 19.
Alice computes 19^6 mod 23. Since 19 ≡ −4, this is (−4)^6 = 4096, and 4096 − 23 × 178 = 2. Her key is 2.
Bob computes 8^15 mod 23. Here 8^2 = 64 ≡ 18, 8^4 ≡ 18^2 = 324 ≡ 2 and 8^8 ≡ 4, so 8^15 ≡ 4 × 2 × 18 × 8 = 1152 ≡ 2. His key is also 2.
An eavesdropper who saw 8 and 19 must find which power of 5 gives 8. With 23 that takes seconds; with a prime hundreds of digits long, nobody knows a fast way.
Common mistakes:
Computing the full power first. 5^15 is about 3 × 10^10; reduce mod 23 after every multiplication instead.
Using your own public number. Alice raises Bob's number to her secret, not her own.
Thinking small numbers are safe. The method's strength comes from the size of the prime.
Remainder tricks like these also appear in our post on binomial remainders and divisibility.
What happened next?
The paper described public-key cryptography but did not give a full practical system for encrypting and signing. A year later three MIT researchers built one, a story told in our post on Rivest, Shamir, Adleman and RSA. ACM's citation for the 2015 award honours Diffie and Hellman "for inventing and promulgating both asymmetric public-key cryptography, including its application to digital signatures, and a practical cryptographic key-exchange method." The announcement notes that a secure https connection still combines public-key methods, to set up a key, with ordinary symmetric encryption.
If modular arithmetic is new to you, the Fermi Concept Library covers concepts across mathematics and computing, so you can read the idea in small steps before trying larger exponents.
What can a student take from their way of working?
Question the assumption everyone shares. For centuries, sharing a key in advance seemed unavoidable. They asked whether it really was.
Talk to people outside your circle. Diffie was pointed to Hellman by a researcher at IBM; Hellman learnt from Feistel over lunch.
Give credit where it is due. Both men cited Merkle, and Hellman later argued for his name on the idea.
Try it now: pick q = 23 and α = 5, choose two new secrets, and check that both sides reach the same key.



