Day 198 · Jul 16

The Mathematics of Cryptography – Diffie–Hellman Exchange

In 1976, Whitfield Diffie and Martin Hellman introduced public‑key cryptography. Two parties can agree on a secret key over a public channel. They pick a prime p and a generator g. Alice sends gᵃ mod p, Bob sends gᵇ mod p. The shared secret is gᵃᵇ mod p. Eve sees gᵃ and gᵇ but cannot easily compute gᵃᵇ unless she can solve the discrete logarithm problem. This one‑way function underlies TLS/SSL (the padlock in your browser) and secure messaging.

If p=23, g=5, Alice picks a=6 (sends 5⁶ mod 23 = 8), Bob picks b=15 (sends 5¹⁵ mod 23 = 19). What is the shared secret?

Practice related topics on DuelMath

Challenge someone →