Read this lesson as text
Diffie-Hellman Example
Number Theory · Axiom Academy
EXAMPLE Diffie-Hellman Key Exchange A complete worked example of secure key exchange using modular arithmetic Excellent work! You've completed the Diffie-Hellman key exchange example. Here's what we learned: Public Parameters: Both parties agree on a prime p = 23 and generator g = 5 , which can be shared openly. Private Keys Stay Secret: Alice's private key a = 6 and Bob's private key b = 15 are never transmitted or shared. Public Exchange: Alice and Bob exchange public values A = 8 and B = 19 , which can be intercepted without compromising security. Shared Secret: Both parties compute the same shared secret s = 2 using their private key and the other's public value. Security Foundation: The security relies on the discrete logarithm problem - it's computationally hard to find a from g a mod p when p is large. In practice, much larger primes (hundreds of digits) are used to ensure security. This protocol forms the basis of secure key exchange in modern cryptography!
This is the written version of the interactive lesson above. See the full Number Theory course.