Back to Demos
3/52
FundamentalsBeginner
Key Exchange Algorithms
Visualize Diffie-Hellman and ECDHE key exchange. See how two parties derive a shared secret securely.
Interactive Demo

Diffie-Hellman Key Exchange
How two parties agree on a shared secret over a public channel, even when someone is watching.
Step 0 of 5
Ready to start
Alice
Public Channel
Bob
Eve (Eavesdropper)Intercepting Public Channel
INTERCEPTED DATA:
Public Common:
Yellow
Alice's Mix:
Orange
Bob's Mix:
Green
Final Secret?...
Why Eve Can't Break It
- •Eve sees the Common Color and both Mixed Colors.
- •To get the Secret Color, she needs either Alice's or Bob's Private Color.
- •"Unmixing" colors is impossible. In math, this is the Discrete Logarithm Problem.
Real World: TLS & DHE
This is exactly how DHE (Diffie-Hellman Ephemeral) and ECDHE (Elliptic Curve DHE) work in TLS 1.2 and 1.3.
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
The "ECDHE" part creates the shared session key securely. The "AES" part uses that key to encrypt data.
Want to learn more?
Read our complete guide on Diffie-Hellman key exchange