← Back

Diffie-Hellman Key Exchange

Establishing a shared secret over an insecure channel

Prime (p)
23
Generator (g)
5
Click "Run Exchange" or "Step Through" to begin

👩 Alice

Private key (a): ?

👨 Bob

Private key (b): ?

How Diffie-Hellman Works

Diffie-Hellman allows two parties to establish a shared secret over an insecure channel without prior key exchange. The security relies on the difficulty of the discrete logarithm problem - while computing g^a mod p is easy, recovering 'a' from the result is computationally infeasible for large numbers. This shared secret can then be used as a key for symmetric encryption like AES.