Diffie-Hellman (DH) is:

  • asymmetric because each side has a different key to start with and they end up with the same secret key
  • is used to produce the symmetric/session-key for a symmetric encryption
  • invented in 1976

How it Works

	E
	|
	|
A——————————————B

A and B wants to secure their connection E is the eavesdropper

1. First A and B agrees publicly on 2 prime numbers

3
17

for a resulting function 3𝑥 mod 17

2a. A selects a private random number

random number = 15

then substitute x with that number to get a result

315 mod 17 = 6

then sends the result 6 publicly to B

2b. B selects a private random number

random number = 13

then substitute x with that number to get a result

313 mod 17 = 12

then sends the result 12 publicly to A

3a. A takes

12 - B’s public result15 - its own private number

1215 mod 17 = 10 = shared secret key

3b. B takes

6 - A’s public result
  13 - its own private number

613 mod 17 = 10 = shared secret key

4. A and B derives the same secret key

And E will have a hard time deriving it from the numbers being passed publicly