r/programming • u/dominatrix-octopus • Jan 16 '18
Cryptography: Diffie-Hellman key exchange explained intuitively using colors
https://youtu.be/YEBfamv-_do?t=2m18s
2.5k
Upvotes
r/programming • u/dominatrix-octopus • Jan 16 '18
View all comments
Show parent comment
3
u/NordicSeeger Jan 16 '18 edited Jan 16 '18
You're correct, the expansion will always create one yn and everything else has at least a single kc as in kc*yn-1 . If you expand the polynomial you can imagine starting from 0 on a circle that's circumference is exactly c and then summing yourself around it. You know you can dismiss everything with c as a factor because those will always loop multiples of 360 degrees and end you back where you started without changing the modulus. Only the yn matters.
It usually helps me to visualize this stuff somehow hence the weird explanations, but I felt like without this tidbit the video is a bit superficial.
Edit: small note about modulos; (a + b) mod c == ((a mod c) + (b mod c)) mod c. This is because if both modulos were non-zero then only adding the together might give a result that's exactly c or greater, but in our case only the one modulo is non-zero.