Skip to content

Commit 819d299

Browse files
committed
Tests
1 parent 6410335 commit 819d299

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/EllipticCurves.jl

+6-7
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,16 @@ function isInfinityPoint(P::EllipticPoint)
1717
end
1818

1919

20-
function double(R::EllipticPoint, P::EllipticPoint, E::EllipticCurve)
20+
function double(P::EllipticPoint, E::EllipticCurve)
2121
if isInfinityPoint(P)
22-
R.x = -1
23-
R.y = -1
24-
return
22+
return P
2523
end
2624

2725
g::BigInt, inv::BigInt, _ = gcdx(2 * P.y, E.n)
2826
if g != 1
2927
return g
3028
elseif g == E.n
31-
R.x = -1
32-
R.y = -1
33-
return
29+
return InfinityPoint()
3430
end
3531

3632
lambda::BigInt = mod((3 * P.x^2 + E.a) * inv, E.n)
@@ -127,6 +123,9 @@ function test_mult()
127123
end
128124
end
129125

126+
# initial
127+
# 1.211539 seconds (5.45 M allocations: 153.242 MiB, 11.24% gc time)
128+
# 21.950572 seconds (112.61 M allocations: 2.961 GiB, 12.85% gc time)
130129

131130
@time test_add()
132131
@time test_mult()

0 commit comments

Comments
 (0)