A and B are communicating. C hears everything A and B say. A and B want to agree on a number, without C knowing what the number is. It may be, for example, that A and B plan to use the number as the key for future encoded messages. The procedure (also often called a protocol):
A and B agree on a (large) prime p and a primitive root a.
These numbers are also known to C. A secretly chooses a (large)
number , B secretly chooses
.
and
mod p are publicly announced (hence known to C). The secret number
will be
mod p.
A possible drawback to this system is that neither A nor B controls
what S is. If S is not a satisfactory number, they may have to repeat the protocol.
Diffie and Hellman suggest the procedure can also be used in
a situation in which n people must find, for each pair of people,
an agreed-upon number. For the number is
.