-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperformance.py
More file actions
36 lines (25 loc) · 971 Bytes
/
performance.py
File metadata and controls
36 lines (25 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from finitefield.finitefield import FiniteField
from edwards import *
from edwards_proj import *
from edwards_ext import *
import time
# the order of jubjub base field
q = 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001
Fq = FiniteField(q, 1)
dd = -(Fq(10240)/Fq(10241))
curve = TwistedEdwardsCurve(Fq(-1), dd)
curve_proj = ProjectiveEdwards(Fq(-1), dd)
curve_ext = ExtendedEdwards(Fq(-1), dd)
curves = [curve, curve_proj, curve_ext]
def test(curve):
p = Point(curve, Fq(0x18ea85ca00cb9d895cb7b8669baa263fd270848f90ebefabe95b38300e80bde1), Fq(0x255fa75b6ef4d4e1349876df94ca8c9c3ec97778f89c0c3b2e4ccf25fdf9f7c1))
q = Point(curve, Fq(0x1624451837683b2c4d2694173df71c9174ffcc613788eef3a9c7a7d0011476fa), Fq(0x6f76dbfd7c62860d59f5937fa66d0571158ff68f28ccd83a4cd41b9918ee8fe2))
t0 = time.time()
for i in range(50000):
p = p + q
t1 = time.time()
print curve, "time: ", t1 - t0
for j in range(10):
print "="*25
for i in curves:
test(i)