r/programming • • Jan 16 '18

Cryptography: Diffie-Hellman key exchange explained intuitively using colors

https://youtu.be/YEBfamv-_do?t=2m18s
2.5k Upvotes

170 comments sorted by

View all comments

102

u/snarfy Jan 16 '18

Breaking encryption is like trying to take the pee out of the swimming pool. It's easy to add pee, hard to remove.

18

u/TheOddScientist Jan 16 '18

Not sure why this was downvoted, a bit archaic but still a logical equivalence.

12

u/snarfy Jan 16 '18

I use it to explain to people like grandma how encryption works.

-5

u/TheOddScientist Jan 16 '18

I suppose if you don't understand how encryption works the analogy can be confusing. In your analogy you are taking a steady stream of information and diluting it in a pool of possibilities. The only difference being there is no valid way of reversing urination in a pool. A better analogy might be stiring salt into fresh water as you can desalinate the water and retrieve the salt yet you cannot readily look at a glass of water and say there is salt in it.

4

u/Lucent_Sable Jan 16 '18

Wouldn't salt water be analogous to steganography though? Encryption is more like KFC's Eleven Herbs and Spices. You know that they are there, but have no idea what they are.

9

u/dnkndnts Jan 16 '18

No, it's not. Alice pees in the pool, Eve can't get the pee back out of the pool because that's a hard problem, but... ok then how can Bob get it back out? It is not equivalent at all, it's just vulgar.

3

u/five_hammers_hamming Jan 17 '18

It's like the paint. But with a low-viscosity yellow paint.

1

u/sysop073 Jan 16 '18

Because of all of the infinite possible analogies for one-way functions, an infinite number of them don't involve urine, but for some reason snarfy went with one that does

0

u/[deleted] Jan 16 '18

[deleted] — view deleted comment

17

u/knome Jan 16 '18

This analogy is gonna get real uncomfortable quick when we move from defending from mere "eve"sdroppers and move on to malicious "mallory", who intercepts messages, changes them, forges them, etc.

4

u/bagtowneast Jan 16 '18

Something about sneaking someone else's pee into your drug test.

4

u/snarfy Jan 16 '18

You described Diffie-Hellman, using pee. Not all encryption is Diffie-Hellman.

3

u/ythl Jan 16 '18

What if you put a peelogger on the person such that when they try to go pee in the pool, the peelogger captures it and you can remove it from the pool?

1

u/SSChicken Jan 16 '18

This would be equivalent of having malware installed on your computer that can watch memory and see what your original key, or color, is. In the video, instead of Eve watching the messages Alice passes to Bob, it's as if Eve was in Alice's house watching over her shoulder as she did it. In that case, security is broken.

1

u/pure_x01 Jan 17 '18

Unless you have a quantum pee extractor. Then you can extract all the pee at once without ever even being near a pool or if the pool exists in several parallel universes. 100% of the pee all the time.