Diffie–Hellman Key Exchange Calculator

Interactive Diffie–Hellman key exchange calculator. Choose a small prime and generator, set Alice and Bob's private keys, and see how the shared secret is derived step-by-step. Educational use only, not for real cryptography.

Full original guide (expanded)

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

  1. Alice publishes A = g^a mod p, Bob publishes B = g^b mod p.
  2. Alice computes s = B^a mod p, Bob computes s = A^b mod p.
  3. Both results match, creating a shared secret without sharing private keys.

Audit: Needs review
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.
No formulas provided in audit spec.
Variables and units
  • No variables provided in audit spec.
Sources (authoritative):
Changelog
Version: 0.1.0-draft
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
Formulas

(Formulas preserved from original page content, if present.)

Version 0.1.0-draft
Citations

Add authoritative sources relevant to this calculator (standards bodies, manuals, official docs).

Changelog
  • 0.1.0-draft — 2026-01-19: Initial draft (review required).