This website works better with JavaScript.
Home
Explore
Help
Sign In
jmg
/
ed448goldilocks
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
addition chain for curve25519
master
Michael Hamburg
9 years ago
parent
2b5f3beb31
commit
6c81eec339
1 changed files
with
14 additions
and
2 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+14
-2
aux/decaffeinate_curve25519.sage
+ 14
- 2
aux/decaffeinate_curve25519.sage
View File
@@ -40,8 +40,20 @@ def decaf_encode_from_E(X,Y):
def isqrt(x):
assert(x.is_square())
if x == 0: return 0
else: return 1/sqrt(x)
def op(st,sh,add):
x,y,z = st
return x,st[1]^(2^sh)*st[add],y
ops = [(1,0),(1,0),(3,1),(6,1),(1,0),(12,2),(25,1),(25,2),(50,2),(125,1),(2,0),(1,0)]
st = (x,x,x)
for sh,add in ops:
st = op(st,sh,add)
#assert st[2] == x^(2^252-3)
i = sqrt(F(-1))
if st[1] == 1: return st[2]
else: return st[2] * i
def decaf_encode_from_E_c(X,Y):
Z = F.random_element()
Write
Preview
Loading…
Cancel
Save