Diffie-Hellman Key Calculator
Enter the public parameters and both private keys to derive the shared secret.
How to use
- Enter your values in the fields above.
- Press Calculate to see your result instantly.
- Use the Share button to copy a link to your result.
About this calculator
The Diffie-Hellman key exchange lets two parties agree on a shared secret over a public channel without ever transmitting the secret itself. Both sides agree on a public prime modulus p and generator g; each picks a private key (a and b) and computes a public key — A = g^a mod p and B = g^b mod p — which they exchange openly. Each side then raises the other's public key to their own private key: the shared secret is s = B^a mod p = A^b mod p = g^(ab) mod p, arriving at the same number without either private key ever crossing the wire.
Security rests on the discrete logarithm problem — computing a from g, p and A = g^a mod p is computationally infeasible for a large enough prime p, even though computing A from a is easy. Computer science students, security engineers, and protocol implementers use small-number examples like this to verify by hand how TLS, SSH, and other protocols establish a shared session key before any application data is sent.
Was this helpful?
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
No calculators found
Comments (0)