Diffie-Hellman Demo

<strong>⚠️ Educational Demonstration Only</strong> - This tool demonstrates the classic Diffie-Hellman key exchange algorithm for learning purposes. For production applications, use ECDH (Elliptic Curve Diffie-Hellman) which provides equivalent security with smaller keys and better performance. This tool uses small parameters for demonstration and is NOT suitable for real-world security.

Privacy: this tool processes your data entirely in your browser. Nothing you paste or type is sent to the server.

A prime number (small for demonstration).

A generator modulo p.

Alice's secret random number.

Bob's secret random number.

Result

Enter your values and press Calculate — the result appears here.

Worked examples

Classic example with small numbers

  • prime = 23
  • generator = 5
  • privateA = 6
  • privateB = 15

Result: Both compute shared secret = 2.

Frequently asked questions

Why is this "educational only"?

This uses small prime numbers that can be factored easily. Real-world DH uses primes with hundreds of digits. Also, classic DH is vulnerable to man-in-the-middle attacks without authentication (like certificates).

How does DH prevent eavesdropping?

An eavesdropper sees g^a mod p and g^b mod p but cannot compute g^(ab) mod p without solving the discrete logarithm problem, which is computationally infeasible for large primes.

💬 Discuss on BestWordz Community

Join the conversation about Cybersecurity, diffie-hellman, key exchange on the BestWordz Community forum.

Visit Forum →
Copied!