How two people agree on a secret
Nobody ever sends the key
Here is the part that surprised me when I first understood it. Two people who have never met can end up holding the same secret number, while someone reading every single message between them cannot work out what it is. That is a key exchange, and it is what happens before your browser sends a password anywhere.
Jaiden
Pick a number and don’t tell anyone. Not even them.
The open channel
A friend
Same here. We’ll still end up with the same key.
Eve is reading everything
Everything above the dashed line: p, g,
A, B, and the scrambled message. The two
private numbers never crossed the channel, so the key was never
there to steal.
These numbers are tiny so you can check the arithmetic by hand — with p = 23 anyone could just try all 22 possibilities. Real ones are hundreds of digits long, which is the only thing standing between the two columns and the person reading the wire.