This page demonstrates how the 'Diffie-Hellman' key exchange algorithm can be used to share a secret while everybody is listening.

To test, get a friend to access this same page on his or her own computer. Then each follow steps 1, 2 and 3 below. When this is done, and a secret has been calculated, you can encode (encrypt) and decode (decrypt) simple text messages.

This demo is just that - a demo. Do not use it to share real secrets!

1. Enter (think up) a secret random number:
2. Result of calculation, tell your partner:
3. Enter what your partner told you:
The calculated secret is:
Enter a message to send:
Encoded result:
Enter encoded message from your partner:
Decoded result: