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
Teaching example: real systems use p of at least 2048 bitsCalculate Diffie-Hellman instantly with the exact formula and a worked example.
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

  1. 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.
  2. Shared secret is calculated automatically as you type.
  3. Check the worked example below to see the formula applied to real numbers.
  4. 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

Server Response TimeImage Dimension for WebSVG PathCaesar CipherMorse CodePig LatinNumbers → LettersLetters to NumbersPhonetic Alphabet (NATO)Binary ↔ TextBase32 / Base58 / Base64Password Strength