Diffie-Hellman Key Exchange in a Nutshell

Explain how the key exchange works in plain language

Step by Step

  1. Alice and Bob agree publicly on a prime modulus 17, and a generator 3

  2. Alice selects a private random number 15

  3. Alice calculates 3^15 mod 17 (three to the power fifteen mod seventeen), sends the result 6 publicly to Bob

  4. Bob selects a private random number 13

  5. Bob calculates 3^13 mod 17, sends the result 12 publicly to Alice

  6. Alice takes Bob’s public result and raise it to the power of her own private number and mod it, i.e. calculates 12^15 mod 17, the result is 10

  7. Bob does the same procedure as Alice, i.e. calculates 6^13 mod 17, the result is 10 (the same)

  8. An analysis of how calculation in step 6 and step 7 are done shows that either side actually did the same calculation with the exponents in a different order. In mathematics, when you flip the exponent, the result doesn’t change.

Exponents in a different order