aboutsummaryrefslogtreecommitdiff
path: root/test/test_e.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_e.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_e.ml')
-rw-r--r--test/test_e.ml10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/test_e.ml b/test/test_e.ml
index e2b5fc8..880b545 100644
--- a/test/test_e.ml
+++ b/test/test_e.ml
@@ -55,6 +55,15 @@ let test_add () =
"3751513699951780822806204149545068929347461752396128233032372349172282127292099402193824058844455410431018547944025"
)))
+let test_double () =
+ let a =
+ f
+ ( "1948821978587447897789631658127568747564453341960450352257323012875526005675549792824154216114310204101716468014510",
+ "3805369745912496441131578309581807518996252052482176821838803458068084239405605134308394924115132794385888965780503"
+ )
+ in
+ Alcotest.(check e) "equals" (E.add a a) (E.double a)
+
let test_sub () =
Alcotest.(check e)
"equals"
@@ -114,6 +123,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;