In a specified finite cyclic group , the discrete logarithm problem is to recover modulo from and . A common choice is a large prime-order subgroup of a multiplicative group of a finite field.
For Diffie-Hellman key exchange, Alice and Bob independently choose private exponents , transmit , and compute respectively and . Both obtain
Solving a discrete logarithm problem reveals a private exponent and breaks this exchange. The converse implication is not known in general: recovering from is the computational Diffie–Hellman problem, rather than literally the same task as computing a logarithm.
The advantage is that parties without an already shared secret can establish a fresh session key, which can then be used with efficient symmetric encryption. A classical secret-key system requires an earlier secure key distribution; ordinary public-key encryption can instead transmit a chosen key, but ephemeral Diffie-Hellman key exchange also permits forward secrecy when private session exponents are erased and the exchange is authenticated. Authentication is essential: an unauthenticated exchange is vulnerable to a man-in-the-middle attack.
For multilateral Diffie-Hellman key exchange with participants with private exponents , send tokens clockwise around a ring. Participant starts the token and sends it to participant . On each subsequent receipt, the receiver raises the token to their own private exponent and sends it onwards, until that token has made transmissions and reaches participant . Its exponent then contains every exponent except . The receiver raises it to locally, obtaining
Every participant receives one such final token. There are tokens with exactly transmitted group elements per token, giving transmissions. No private exponent is transmitted.