Diffie-Hellman Key Exchange Protocol
- Alice and Bob agree on a large prime number n and another number
g; these numbers may not be secret;
- Alice generates a random number x and sends to Bob the value:
X = g^x mod n;
- Bob generates a random number y and sends to Alice the value:
Y = g^y mod n;
- Alice receives the value of Y and computes: K_x = Y^x mod
n;
- Bob receives the value of X and computes K_y = X^y mod n;
The algorithm ensures that the values K_x and K_y are equal and can
be used as a key in a secret-key encryption algorithm.