Skip to content

Instantly share code, notes, and snippets.

@vito-lbs
Created May 19, 2014 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vito-lbs/ac1ad852e85428872b03 to your computer and use it in GitHub Desktop.
Save vito-lbs/ac1ad852e85428872b03 to your computer and use it in GitHub Desktop.
group = ECDSA::Group::Secp256k1
point_field = ECDSA::PrimeField.new group.order
e1 = ECDSA.normalize_digest logs[0].uuid, group.bit_length
e2 = ECDSA.normalize_digest logs[1].uuid, group.bit_length
pack = Choripan::Packer.new
up1 = pack.unpack(logs[0].signature)
up2 = pack.unpack(logs[1].signature)
s1 = up1[1]
s2 = up2[1]
raise 'wat' if up1[0] != up2[0]
r = up1[0]
m = point_field.mod((e1 - e2) / (s1 - s2))
top = point_field.mod((e1 * s2) - (e2 * s1))
bottom = point_field.inverse(r * (s1 - s2))
p = point_field.mod(top * bottom)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment