Created
April 25, 2016 15:01
-
-
Save AndyNovo/6a7f847760532b69576803733317d483 to your computer and use it in GitHub Desktop.
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
def invMod(x, p): | |
return pow(x, p-2, p) | |
def addECC(x1,y1,x2,y2,a,b,p): | |
s = (invMod(x2-x1, p)*(y2-y1)) % p | |
if ((x1 - x2) % p == 0) and ((y1-y2) % p == 0): | |
s=(invMod(2*y1, p)*(3*x1*x1 + a)) % p | |
x3 = (s*s -x1 -x2) %p | |
y3 = (s*(x1-x3) -y1) % p | |
return x3,y3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment