basic

Diffie-Hellman Shared Secret Calculator

K = g^(ab) mod p — toy key exchange for small primes.

Computes a Diffie-Hellman shared secret from public generator g, prime p, and private keys a and b. For educational toy primes only.

10 of 10 free calculations left today. Sign up for more.
Published Last reviewed 1 min read

Inputs

Results

Enter values and click Calculate to see results.
Was this helpful?

How to use this calculator

  1. Fill in the inputs above using the units you already have.
  2. Values update automatically as you type — no submit button needed.
  3. Hover any result row for the underlying formula and intermediate values.

Formula

Public A = g^a mod p; B = g^b mod p; Shared K = B^a mod p

In depth

Computes a Diffie-Hellman shared secret from public generator g, prime p, and private keys a and b. For educational toy primes only.