Skip to content

Instantly share code, notes, and snippets.

@mcieno
Created September 16, 2019 10:54
Show Gist options
  • Save mcieno/c751c54cc16cb3d7f1822545e5c5afce to your computer and use it in GitHub Desktop.
Save mcieno/c751c54cc16cb3d7f1822545e5c5afce to your computer and use it in GitHub Desktop.
Solve DLP on Elliptic Curves.
# Curve parameters
p = 1048583
a, b = 1, -1
# Target secret key
d = 4121
# Setup curve
E = EllipticCurve(GF(p), [a, b])
G = E.gen(0)
P = d * G # (429940 : 231132 : 1)
dl = discrete_log(P, G, G.order(), operation='+')
assert dl == d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment