Skip to main content

Diffie-Hellman Key Exchange

Diffie-Hellman key exchange (DH)is a method of securely exchanging cryptographic keys over a public channel and was one of the first public-key protocols as originally conceptualized by Ralph Merkle and named after Whitfield Diffie and Martin Hellman

The simplest and the original implementation of the protocol uses the multiplicative group of integers modulop, where p is prime, and g is a primitive rootmodulo p. These two values are chosen in this way to ensure that the resulting shared secret can take on any value from 1 to p --1. Here is an example of the protocol, with non-secret values in blue, and secret values in red.

image

Both Alice and Bob have arrived at the same value s, because, under mod p, More specifically,

Note that only a, b, and (g^ab^modp=g^ba^modp) are kept secret. All the other values -- p,g,g^a^modp, and g^b^modp -- are sent in the clear. Once Alice and Bob compute the shared secret they can use it as an encryption key, known only to them, for sending messages across the same open communications channel.