Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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