Diffie–Hellman Key Exchange Calculator
Simulate the Diffie–Hellman exchange with small integers to see how public values produce the same shared secret.
Inputs
Use small integers for learning. This is not suitable for real cryptography.
Results
Alice public value
—
Bob public value
—
Shared secret (Alice)
—
Shared secret (Bob)
—
How the exchange works
- Alice publishes A = g^a mod p, Bob publishes B = g^b mod p.
- Alice computes s = B^a mod p, Bob computes s = A^b mod p.
- Both results match, creating a shared secret without sharing private keys.
Formula (LaTeX) + variables + units
This section shows the formulas used by the calculator engine, plus variable definitions and units.
Note: This page needs review to confirm formulas and sources.
Note: This page needs review to confirm formulas and sources.
No formulas provided in audit spec.
Variables and units
- No variables provided in audit spec.
Sources (authoritative):
- NIST — Weights and measures — nist.gov · Accessed 2026-01-19
https://www.nist.gov/pml/weights-and-measures - FTC — Consumer advice — consumer.ftc.gov · Accessed 2026-01-19
https://consumer.ftc.gov/
Changelog
Version: 0.1.0-draft
Last code update: 2026-01-19
Last code update: 2026-01-19
0.1.0-draft · 2026-01-19
- Initial audit spec draft generated from HTML extraction (review required).
- Verify formulas match the calculator engine and convert any text-only formulas to LaTeX.
- Confirm sources are authoritative and relevant to the calculator methodology.
Verification pending · Last code update: 2026-01-19