Diffie–Hellman is used for:
Diffie–Hellman Key Exchange
Primitive roots, Diffie–Hellman setup and the key exchange with a worked example, key-exchange protocols, and the man-in-the-middle attack on unauthenticated Diffie–Hellman.
How to read this page
Every original slide is shown unchanged. Yellow marks on a slide point to a numbered note: hover or tap a mark to jump to its note, and hover a note to see its marks. Questions tagged Past exam appeared on a real paper; Prediction questions are likely angles, not confirmed. Pick an answer to each question: a wrong pick tells you why it is wrong, so you can try again.
Diffie-Hellman Key Exchange
Notes
Diffie–Hellman lets two parties agree on a shared secret over an insecure channel. It exchanges a KEY; it doesn’t encrypt messages.
Exam angle
Primitive Root
Notes
A primitive root g of prime q: its powers g¹ … g^(q−1) mod q produce every number 1 … q−1.
Diffie-Hellman Key Exchange
Exam angle
q = 23, g = 5, a = 6, b = 15. Find A, B and the shared key.
Compare with the model answer
A = 5⁶ mod 23 = 8. B = 5¹⁵ mod 23 = 19. K = 19⁶ mod 23 = 8¹⁵ mod 23 = 2.
Diffie-Hellman Example
Notes
Security rests on the discrete logarithm problem: from gᵃ mod q it is infeasible to find a.
Man-in-the-Middle Attack
Notes
MITM: Darth swaps in his own values and shares one key with Alice and another with Bob. Plain DH has no authentication; fix with signatures or certificates.
Trap Diffie–Hellman alone is vulnerable to man-in-the-middle because the public values are not authenticated.
Exam angle
Unauthenticated Diffie–Hellman is vulnerable to: