From b6f4ddea9b452ea9f599bb0b12e5d05991914885 Mon Sep 17 00:00:00 2001 From: Advaita Saha Date: Thu, 21 Sep 2023 18:16:41 +0530 Subject: [PATCH] fix: doubling point error for twisted edwards projective --- constantine/math/elliptic/ec_twistededwards_projective.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constantine/math/elliptic/ec_twistededwards_projective.nim b/constantine/math/elliptic/ec_twistededwards_projective.nim index f2755c4a..a1f7aac3 100644 --- a/constantine/math/elliptic/ec_twistededwards_projective.nim +++ b/constantine/math/elliptic/ec_twistededwards_projective.nim @@ -279,11 +279,11 @@ func double*[Field]( # (B-C-D) => 2X1Y1, but With squaring and 2 substractions instead of mul + addition # In practice, squaring is not cheap enough to compasate the extra substraction cost. + E.square(P.x) r.x.prod(P.x, P.y) r.x.double() D.square(P.y) - E.square(P.x) E *= Field.C.getCoefA() r.y.sum(E, D) # Ry stores F = E+D