Diffie–Hellman Key Exchange
Shared secret from public values.
Key idea
Shared secret from public values.
In depth
Two people agree on a prime p and base g, pick secret numbers a and b, and exchange gᵃ and gᵇ mod p. Each computes the same shared key gᵃᵇ. Eavesdroppers face the discrete logarithm problem.
Worked example
p = 23, g = 5, a = 6, b = 15: A = 8, B = 19; shared key 2.
Real-world uses
- Agreeing a secret key over an insecure connection, such as in messaging apps and VPNs
Common mistake
Forgetting it provides no authentication by itself.
How to learn this
- Read the key idea and say it in your own words.
- Work through the worked example, then try a similar problem.
- Use the interactive lesson’s visual and mini-quiz to check the pattern.
Frequently asked questions
What is Diffie–Hellman Key Exchange?
Shared secret from public values. It is a topic at the expert level in Discrete Math & Number Theory.
Where is Diffie–Hellman Key Exchange used in real life?
Real-world examples: Agreeing a secret key over an insecure connection, such as in messaging apps and VPNs.
What should I learn before Diffie–Hellman Key Exchange?
Make sure you are comfortable with RSA Cryptography, the previous topic in Discrete Math & Number Theory.
What is a common mistake with Diffie–Hellman Key Exchange?
Forgetting it provides no authentication by itself.
How can I practise Diffie–Hellman Key Exchange?
Open the interactive lesson, play with the visual, then answer the three-question mini-quiz. Getting two right marks the topic complete.
What comes after Diffie–Hellman Key Exchange?
Move on to Hash Functions and Checksums next.
Related expert topics in Discrete Math & Number Theory
- Strong Induction – Assume all earlier cases to prove the next.
- Well-Ordering Principle – Every nonempty set of positive integers has a least element.
- Partial Orders – Reflexive, antisymmetric, transitive relations.
- Cardinality of Sets – Comparing sizes of infinite sets.
- Countable and Uncountable Sets – ℕ and ℚ are countable; ℝ is not.
- Cantor’s Diagonal Argument – Proof that real numbers are uncountable.