Diffie-Hillman Key Exchange

  1. Alice and Bob agree on two numbers y and p with 0 < y < p. These numbers are not private and can be known by anyone.

  2. Alice picks a private number 0 < a and computes α = ya mod p. Alice sends α to Bob.

  3. Meanwhile, Bob picks a private number 0 < b and computes β = yb mod p. He then sends β to Alice.

  4. Alice computes k = βa mod p and Bob computes k = αb mod p. Both of them obtain the same number k which can then be used as the private key.