Loading...
Loading...
Math for CS · Axiom Academy
LESSON Diffie–Hellman Key Exchange Two strangers shouting across a crowded room can still agree on a secret nobody else can hear. Before the math, here is the cleanest physical analogy. Alice and Bob publicly agree on a "common paint" — say, a particular shade of yellow. Eve, who is eavesdropping, sees this color too. Alice secretly picks her own color (red) and mixes it into the yellow. She sends the resulting orange to Bob. Bob secretly picks his own color (blue) and mixes it into the yellow. He sends the resulting green to Alice. Alice adds her secret red to Bob's green. Bob adds his secret blue to Alice's orange. Both arrive at the same brown. Eve has seen yellow, orange, and green, but to compute brown she would need to unmix the paints to recover red or blue — and unmixing paint is hard. The math version replaces "mixing paint" with "modular exponentiation," and "unmixing" with "discrete logarithm." Public parameters (anyone can see them, including Eve): g — a generator (or more generally, an element of large order) modulo p Alice picks a secret integer a at random and sends to Bob. Bob picks a secret integer b at random and sends to Alice. Both arrive at the same value K , because And that shared K becomes the secret key for symmetric encryption (typically AES) of the rest of the conversation. 3. Why Eve Can't Read the Secret What does Eve see on the wire? Exactly four numbers: p , g , , and . To compute K she would need either a or b .
This is the written version of the interactive lesson above. See the full Math for CS course.