Skip to content

Instantly share code, notes, and snippets.

@abi
Created June 10, 2011 12:46
Show Gist options
  • Save abi/1018775 to your computer and use it in GitHub Desktop.
Save abi/1018775 to your computer and use it in GitHub Desktop.
Diffie–Hellman Key Exchange with CoffeeScript DSLs
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