Diffie Hellman

Motivation

Simmetric cryptography algorithms are used to send secret messages between two parts and . In the literature, and are usually called Alice and Bob. Alice and Bob first agree on a secret key , an encryption function and a decryption function . Then we have the following protocol:

  1. Alice wants to send to Bob.
  2. Alice encrypts .
  3. Alice sends to Bob.
  4. Bob recovers

A good encryption algorithm must hold the property that no one observing can obtain , even knowing and . That is, cryptographers assume everyone knows the algorithm (but not the secret ). This is known as the Kerckhoffs principle.

Diffie Hellman

How can Alice and Bob agree on a secret securely if they live far away? Diffie-Hellman introduced a solution for this problem in a paper from 1976. Their protocol uses multiplicative groups to agree on a random number securely.

Setup: Alice and Bob agree on a finite group and a generator .

  1. Alice samples a random and computes .
  2. Alice sends to Bob.
  3. Bob samples a random and computes .
  4. Bob sends to Alice.
  5. Alice computes
  6. Bob computes

Note that . So Alice and Bob reached to the same random number .

The security of the algorithm depends on the chosen group . For some groups, computing is easy, but computing is hard. This is called the Discrete Logarithm Problem. Actually, the notation is not used, but you can see where the name comes from. This is why groups are useful in cryptography. You can use the fact that the discrete logarithm problem is hard, to "hide" stuff inside a group.

In step 1, Alice "hides" in the group by computing . Then sending is safe if we assume the attackers cannot solve the discrete logarithm problem. Nowadays, is safe to assume this if we use for a really big . But choosing a secure group is a delicate decision. As hardware and algorithms get better, encryption algorithms have to keep up with it. Other groups such as those found on elliptic curves have become more popular for having a more difficult discrete logarithm problem.

The discrete logarithm problem is an example of a one-way function. That is, a function that is easy to compute but hard to invert.