Diffie-Hellman Key Exchange with Javascript sometimes wrong
问题 After watching this video http://youtu.be/3QnD2c4Xovk I've been trying to follow it step by step, and haven't been able to produce the same results. Notably, when I try to do Math.pow(3, 54)%17, I get 7. While the speaker gets 15. I wrote a method that is supposed to simulate Diffie Hellman's key exchange using exactly what I found on http://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange This is my code: function diffieHellman(generator, prime, alice_secret, bob_secret){ var alice