Diffie-Hellman protocol is used for key exchange over an unsecure channel. The algorithm guarantees that even if the channel is eavesdropped, the attacker will not be able to reconstruct the exchanged key. The key might be for example later used for symmetric cryptography.
The algorithm is based on associativeness of the power operation.
Respectively, on the modular variant of the formula.
However is the calculation of the resulting value fast, it is very difficult to find out the one of the private values known only by some participant of the handshake. This principle, on which the security of the protocol is based, is called discrete logarithm problem.
- The participants publically agree on a common modulo and base .
- Each participant generates his private key – an exponent coprime to .
- Each participant powers the base to the private exponent a passes the result to the next participant.
- The algorithm terminates, when each of the original bases is processed by each participant.