Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
| Download
Implementation of the group law on an Edwards curve
Project: 18.783 Fall 2023
Views: 112License: GPL3
Image: ubuntu2204
Kernel: SageMath 9.8
For the sake of comparison we first give formulas for Weierstrass curves in projective coordinates; scroll down to see the formulas for Edwards curves
In [1]:
In [2]:
In [4]:
Timing add_affine on random points...
6.34 µs ± 1.02 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Timing add_add_affine on equal points...
8.06 µs ± 1.01 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Testing dbl_affine...
6.97 µs ± 402 ns per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Timing add_projective on random points...
11.5 µs ± 1.7 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Timing add_projective on equal points...
16.7 µs ± 2.83 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Testing dbl_projective...
11.2 µs ± 1.37 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Note that distinct triples of proejctive coordinates may define the same projective point. To compare points for equality we need to use the equal_projective function above (which also works for Edwards curves)
In [4]:
R1 = (39631903559207355134813242690485305706327172391023199616984319804673277252824, 33869231864040439687106036648793069871874765452794702250861206505319640701175, 1271603232244282005892045156571757933303549172868729422943298126929250743038)
R2 = (39003209298511745779211371247669215406384172665513230424454802014897447644459, 44765880993678661226918577289361451240836579603741727790577915314251084196108, 77363509625474818908132568781582763179407795883667700618495823692641474154245)
R1 == R2: False
equal_projective(R1,R2): True
In [5]:
In [6]:
Affine points on Edwards curve x^2 + y^2 = 1 + 3x^2y^2 over F_17
[0, 1]
[0, 16]
[1, 0]
[2, 5]
[2, 12]
[3, 4]
[3, 13]
[4, 3]
[4, 14]
[5, 2]
[5, 15]
[7, 7]
[7, 10]
[10, 7]
[10, 10]
[12, 2]
[12, 15]
[13, 3]
[13, 14]
[14, 4]
[14, 13]
[15, 5]
[15, 12]
[16, 0]
In [7]:
Timing add_edwards on random points...
9.31 µs ± 2.12 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Timing add_edwards on equal points...
7.75 µs ± 1.14 µs per loop (mean ± std. dev. of 7 runs, 30000 loops each)
Timing dbl_edwards...
4.86 µs ± 541 ns per loop (mean ± std. dev. of 7 runs, 30000 loops each)
In [0]: