aboutsummaryrefslogtreecommitdiff
path: root/test/test_e2.ml
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2025-08-01 13:42:15 +0200
committerNicholas Rodrigues Lordello <[email protected]>2025-08-01 16:03:13 +0200
commite77561ac7f94668039adf9db57f0c6f9248eeb16 (patch)
tree5cb6b9acc88f034d30a86aff777f5e7621e880f4 /test/test_e2.ml
parent89f936fff830cd245d47fb5fb6e109c56216c7af (diff)
Use Projective Coordinatesfeat/projective-coordinates
I modified the curve implementation to use projective coordinates, but there wasn't a material speedup of the BLS12-381 pairing implementation. I suspect it is related to the fact that I am not implementing the Miller Loop in a way that takes advantage of the coordinate projection, which makes things take more time in the end.
Diffstat (limited to 'test/test_e2.ml')
-rw-r--r--test/test_e2.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_e2.ml b/test/test_e2.ml
index d4f951b..fe02647 100644
--- a/test/test_e2.ml
+++ b/test/test_e2.ml
@@ -75,6 +75,20 @@ let test_add () =
"2193129241285505962248559104914181807138658074292296828774608320812063550960488358009160505763316933125829480800311";
|] )))
+let test_double () =
+ let a =
+ f
+ ( [|
+ "2630340632582992300068504223042664782235656344249493885516510645984188976796605076720730074664979072939686934257721";
+ "3837313288726631479216536661083348837649337798727188764618972962388445003540771017271319539046080622692222479670778";
+ |],
+ [|
+ "1683267476147804034933489382796354199818919863598454325548320805934667239588199593331393365665593904784252069691594";
+ "1024386153970382602226736749102780316785763625305478417896374484204124772205537751029991953527668491051585823287162";
+ |] )
+ in
+ Alcotest.(check e2) "equals" (E2.add a a) (E2.double a)
+
let test_sub () =
Alcotest.(check e2)
"equals"
@@ -174,6 +188,7 @@ let tests =
test_case "Is On Curve" `Quick test_curve;
test_case "Is In Canonical Subgroup" `Quick test_subgroup;
test_case "Addition" `Quick test_add;
+ test_case "Double" `Quick test_double;
test_case "Subtraction" `Quick test_sub;
test_case "Scalar Multiplication" `Quick test_scalar_mul;
test_case "Additive Inverse" `Quick test_neg;