Cryptography
Math · Intermediate · Lesson 4 of 7

Sharing a Secret in Public

Diffie–Hellman key exchange

An interactive lesson with 7 steps, about 6 minutes: you predict, drag and solve, with instant feedback on every answer. It runs in your browser and needs JavaScript.

What you’ll learn

  • Diffie–Hellman lets two people agree on a secret over a public channel.
  • Each sends gsecret mod pg^{\text{secret}} \bmod p; both compute gab mod pg^{ab} \bmod p.
  • Security rests on the difficulty of the discrete logarithm.

Steps

  1. Mixing paint
  2. With numbers
  3. Alice’s message
  4. Eve tries brute force
  5. Bob’s public number
  6. Times versus powers
  7. The shared secret