In the simple case of prime groups,
Alice and Bob agree on a prime p and a generator g of a
multiplicative subgroup modulo p. Alice sends g
a mod p,
Bob sends g
b mod p, and each computes a shared secret
g
ab mod p. While there is also a Diffie-Hellman exchange
over elliptic curve groups, we address only the “mod p” case.
The security of Diffie-Hellman is not known to be equivalent
to the discrete log problem (except in certain groups [13,
33, 34]), but computing discrete logs remains the best known
cryptanalytic attack. An attacker who can find the discrete
log x from y = g
x mod p can easily find the shared secret.
Textbook descriptions of discrete log can be misleading
about the computational tradeoffs, for example by balancing
parameters to minimize overall time to compute a single
discrete log. In fact, as illustrated in Figure 1, a single large
precomputation on p can be used to efficiently break all
Diffie-Hellman exchanges made with that prime.
The typical case Diffie-Hellman is typically implemented
with prime fields and large group orders. In this case, the
most efficient discrete log algorithm is the number field sieve
(NFS) [21, 24, 43].1 There is a closely related number field