Key exchange
Diffie-Hellman Demo
Shows how two parties derive the same shared secret over a public channel.
Playground
Change inputs and inspect the transformation
Both sides combine public parameters with private exponents under modular arithmetic.
Output
Shared secret
2
Bob computes
2
Steps
Transformation trace
Public parameters
p = 23, g = 5 => shared openly
Everyone can know the prime modulus and generator.
Alice public value
5^6 mod 23 => 8
Alice keeps her exponent private and sends this public value.
Bob public value
5^15 mod 23 => 19
Bob keeps his exponent private and sends this public value.
Shared secret
19^6 mod 23 = 8^15 mod 23 => 2 = 2
Both sides arrive at the same value without sending it directly.