Diffie-Hellman Key Exchange in a Nutshell
By David Xiao
Step by Step
-
Alice and Bob agree publicly on a prime modulus 17, and a generator 3
-
Alice selects a private random number 15
-
Alice calculates 3^15 mod 17 (three to the power fifteen mod seventeen), sends the result 6 publicly to Bob
-
Bob selects a private random number 13
-
Bob calculates 3^13 mod 17, sends the result 12 publicly to Alice
-
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
-
Bob does the same procedure as Alice, i.e. calculates 6^13 mod 17, the result is 10 (the same)
-
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.