For Educators · Diffie-Hellman
Diffie-Hellman for a password hash
Built for educators teaching it to a class. Drop a live demo into a lecture or assign it as a shareable link — no lab installs. Simulate a password hash live below — adjust the inputs and watch it respond, right in your browser.
Diffie-Hellman Key ExchangeLive
a shared secret over an open line
Alice
secret a = 6
sends A = g^a = 8
key = B^a = 2
Bob
secret b = 15
sends B = g^b = 19
key = A^b = 2
Eavesdropper sees g=5, p=23, A=8, B=19 — but cannot find the key 2
Controls
Presets
Diffie-Hellman lets two strangers agree on a secret key while an eavesdropper hears everything. Both share public numbers g and p, each picks a private exponent, and they exchange g raised to it. Raising the other's public value to your own secret yields the same shared key — yet recovering it from the public traffic requires solving the discrete logarithm, which is infeasible.
Data Inspector
Alice sends A8
Bob sends B19
Shared secret2
Match?yes ✓
Governing equation
Reading this result: Both sides arrive at the same key 2 because (g^a)^b and (g^b)^a are the same value mod 23 — yet an eavesdropper who sees g, p, A and B must still solve a discrete logarithm to recover it.
Runs locally in your browser — free forever. Scale to the cloud when reality gets heavy.
Also for:StudentsResearchersEngineersHobbyists & MakersK-12 StudentsFirst RespondersGeneral version →
More with Diffie-Hellman
Frequently asked questions
- Is this good for educators?
- Yes — this version of "Diffie-Hellman for a password hash" is framed for educators teaching it to a class. Drop a live demo into a lecture or assign it as a shareable link — no lab installs.
- Do I need to install anything?
- No. It runs in any modern browser, free, with no account required.