Key exchange (Diffie-Hellman)
Key exchange lets two computers that have never met agree a secret key while someone listens to every message, without the listener learning the key. They then use that key for fast symmetric encryption.
Two people each mix a secret paint colour into a shared public colour and swap the results. Each adds their own secret again and both end up with the same final colour. An onlooker who saw the swapped pots cannot unmix them.
Why it matters
Nearly every secure connection on the internet starts with one.
In plain words
Key exchange lets two computers that have never met agree a secret key while someone listens to every message, without the listener learning the key. They then use that key for fast symmetric encryption.
Think of it like this
Two people each mix a secret paint colour into a shared public colour and swap the results. Each adds their own secret again and both end up with the same final colour. An onlooker who saw the swapped pots cannot unmix them.
Why it matters
Nearly every secure connection on the internet starts with one.
Where you meet it
Every time you load an https website or start a WhatsApp chat.
More diagrams: What happens when you open a secure website · How harvest now, decrypt later works
Go deeper history and technical detail
Published by Diffie and Hellman in 1976. Today's versions mostly use elliptic curves (ECDH, often the curve X25519). Because Shor's algorithm breaks it, the post-quantum replacement is a 'key encapsulation mechanism' (KEM), standardised by NIST as ML-KEM. Browsers now commonly run both side by side, which is called a hybrid.
Read or watch next
- How Public Key Cryptography Really WorksQuanta Magazine (2024), article
- KEMs and Post-Quantum ageFilippo Valsorda, blog post
- New Directions in CryptographyWhitfield Diffie and Martin Hellman (1976), paper
- CryptographyJonathan Katz, University of Maryland on Coursera, course
- CS255: Introduction to CryptographyDan Boneh, Stanford University (Winter 2025), course
- Diffie-Hellman Key ExchangeArt of the Problem, video
Related terms
Cite this page Encryption Observer, “Key exchange (Diffie-Hellman)”, encryption.observer/terms/key-exchange/, checked December 2026.