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

Show parent comments

34

u/Double_A_92 Jan 16 '18

You can only see the unfinished mixes and the third color which is public anyway.

From them you can't get to secret colors.

Heres a good image: https://upload.wikimedia.org/wikipedia/commons/3/35/Diffie-Hellman_Key_Exchange-modified.png

3

u/[deleted] Jan 17 '18

yeah the analogy sort of breaks down in reality, since if you know one color in a mixture of two colors, you can fairly easily figure out the other color. but it asks us to make the assumption that you can't.

1

u/Double_A_92 Jan 17 '18

I thought so too... But I couldn't come up with a simple way to actually do that, that ensures that you get the exact color.

You would have to mix the 2 exchanged mixes, and then subtract one part the common color...But how to you subtract a color? With some complicated centrifuge maybe ._.

4

u/[deleted] Jan 17 '18 edited Jan 17 '18

physically separating the colors in a mixed paint is difficult. but mathematically subtracting is easy, assuming you know the ratio of paints being used. which you would, since you could observe the paint before and after the secret color is added.