LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What problem did Diffie-Hellman key exchange solve in 1976, and what is the color analogy for the protocol?

It let two parties agree on a shared secret key over a completely public channel, without ever having met before. The colour analogy: each side mixes a public colour with their secret colour, exchanges the mix, and re-mixes with their own secret — both end up with the same final blend.

Before DH (1976): symmetric crypto required a pre-shared key. Distributing keys to billions of internet peers was impossible without a private courier. The DH key exchange was the original breakthrough that made modern internet security possible.

Color analogy:

  1. Alice and Bob agree on a public colour (yellow).
  2. Each picks a secret colour (Alice orange, Bob teal).
  3. Each mixes public + secret and sends the result publicly.
  4. Each re-mixes the received mixture with their own secret → both get the same final brown.

Even with full visibility of yellow, orange-yellow, and teal-yellow, an attacker can't "un-mix" to recover orange or teal — that's the hard part. Re-mixing without one of the secrets is infeasible.

Mathematical version:

Step Alice Bob
Public p (large prime), g (generator) same
Private picks a ∈ {2, …, p−2} picks b
Compute A = g^a mod p B = g^b mod p
Send sends A sends B
Shared key B^a = g^(ab) mod p A^b = g^(ab) mod p

Both end up with g^(ab) mod p. Eve sees g, p, A, B — to compute g^(ab) she'd have to solve the discrete log problem (recover a from A), which is infeasible for large p.

Historical note: declassified 1997 documents revealed Cocks (1973) at GCHQ had invented the same idea three years earlier — but as classified work it had no impact on industry. Public credit goes to Diffie, Hellman, and Merkle.

Tip: A small worked example uses p=29, g=2, a=5, b=4 and produces shared key 23. Try it yourself — 2^5 mod 29 = 3, 2^4 mod 29 = 16, 16^5 mod 29 = 23 = 3^4 mod 29.

From Quiz: ISF / Asymmetric Cryptography | Updated: Jul 14, 2026