aboutsummaryrefslogtreecommitdiff
path: root/test/test_e12.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_e12.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_e12.ml')
-rw-r--r--test/test_e12.ml35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/test_e12.ml b/test/test_e12.ml
index 6be08a8..8c76bc6 100644
--- a/test/test_e12.ml
+++ b/test/test_e12.ml
@@ -156,6 +156,40 @@ let test_add () =
"0";
|] )))
+let test_double () =
+ let a =
+ f
+ ( [|
+ "0";
+ "0";
+ "0";
+ "0";
+ "864680025495851032298585449242495442172586480369653270569427520081920647109443766686964546009031896772231151484739";
+ "0";
+ "0";
+ "0";
+ "0";
+ "0";
+ "1631392878509829468330827308350745651550160006042966046936061802639012597909369897842804975745918562123972568708986";
+ "0";
+ |],
+ [|
+ "0";
+ "0";
+ "0";
+ "3175875744091331376881702916348722059990202461121243501806124053462822942076308690447194451748015149897939410507835";
+ "0";
+ "0";
+ "0";
+ "0";
+ "0";
+ "1261674949629831053147743653050474475817726050930614703730644111735569882980952175496663479511045926628196951977486";
+ "0";
+ "0";
+ |] )
+ in
+ Alcotest.(check e12) "equals" (E12.add a a) (E12.double a)
+
let test_sub () =
Alcotest.(check e12)
"equals"
@@ -448,6 +482,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;