Created
June 10, 2011 12:46
-
-
Save abi/1018775 to your computer and use it in GitHub Desktop.
Diffie–Hellman Key Exchange with CoffeeScript DSLs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
us -> | |
p = prime() | |
g = primitiveRoot p | |
send p, g | |
, | |
them (data) -> | |
p = data.p | |
g = data.g | |
, | |
both -> | |
x = random() | |
y = exp g x mod p | |
send y | |
, | |
both (data) -> | |
y_b = data.y | |
key = exp y_b x mod p |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment