Jump to content

Cryptography/Diffie-Hellman

From Wikibooks, open books for an open world

Diffie-Hellman, named for creators Whitfield Diffie and Martin Hellman, was the first (publicly known, at least) public key algorithm and was published in 1976. Its security relies on the discrete logarithm problem, which is still thought to be difficult.

Diffie-Hellman is generally used to generate a unique key by two (or more) parties with which they may then encrypt and exchange another key. This is similar to the use of the RSA algorithm within PGP.

Alice and Bob select a large prime number n, which will be the modulus. They then select another number c that is primitive mod n, which will be the base. These two numbers may be broadcast far and wide. At this point Bob and Alice both select large, random integers (a and b, respectively) in secret, and exchange the result of the exponentiation:


Alice performs and sends A to Bob in the clear.


Bob then performs and sends B to Alice in the clear.


At which point Alice knows a and B, so she computes:

while Bob, knowing A and b, computes:

and,


This is simply based on the commutative property of multiple exponents

.

An eavesdropper can get A and B, but cannot easily calculate the key.