Diffie-Hellman
Calculate Diffie-Hellman instantly with the exact formula and a worked example.
Diffie-Hellman
Prime modulus p
Generator g
Alice's secret key a
Bob's secret key b
Shared secret
18
Alice's public key A
4
Bob's public key B
10
Modulus p
Prime number
More about: Diffie-Hellman
What it calculates
The “Diffie-Hellman” calculator computes Shared secret from 4 parameters: prime modulus p, generator g, alice's secret key a, bob's secret key b.
Standard IT calculations for developers and sysadmins.
Example calculation
With parameters Prime modulus p = 23, Generator g = 5, Alice's secret key a = 4, Bob's secret key b = 3 the result is 18 (Teaching example: real systems use p of at least 2048 bits).
How to use
- Enter prime modulus p, generator g, alice's secret key a and bob's secret key b — each field above is adjustable with a slider.
- Shared secret is calculated automatically as you type.
- Check the worked example below to see the formula applied to real numbers.
- Copy the result or bookmark this calculator.
Related calculators
FAQ
How is Diffie-Hellman calculated?
The Diffie-Hellman calculator computes Shared secret from prime modulus p, generator g, alice's secret key a, bob's secret key b. Enter your values above and the exact formula is applied instantly; a worked example with real numbers is shown below.
Is the Diffie-Hellman calculator free?
Yes. It is completely free, needs no signup, runs entirely in your browser, and sends no data to any server.
More calculators in this category
Explore related free tools