Tested tool guide
Tested browser tools
Checked August 16, 2026
What Diffie-Hellman Key Exchange Visualizer does, with a checked example
Follow one complete exchange from public parameters through both matching secret calculations. Enter a prime modulus p, a base g, and separate private exponents for Alice and Bob. The visualizer shows each public value, then uses the received public value to derive the same result on both sides, alongside a color-mixing analogy. The common surprise is that Alice's and Bob's public values are meant to be exposed, while their private exponents and the resulting shared secret must remain confidential. Matching outputs demonstrate agreement, not authentication or production-grade security.
Worked example
A concrete input and expected output from the current implementation.
Input
p = 23, g = 5, Alice private exponent a = 6, Bob private exponent b = 15
->
Expected output
Alice public value A = 5^6 mod 23 = 8. Bob public value B = 5^15 mod 23 = 19. Alice computes 19^6 mod 23 = 2, and Bob computes 8^15 mod 23 = 2. The shared secret is 2.
Each side combines the other side's public value with its own private exponent. Both calculations reduce to 5^(6*15) mod 23, so they produce the same residue, 2.