From 97e2c6b97b9cee0d62d1953e6f2ba3fcaa2a647f Mon Sep 17 00:00:00 2001 From: Antonio Sanso Date: Mon, 4 Mar 2024 12:31:08 +0100 Subject: [PATCH] add G2 --- main.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 7cf429d..eefd584 100644 --- a/main.py +++ b/main.py @@ -224,6 +224,10 @@ def case01_add_G1(): def case02_add_G2(): + # Commutativity + result_comm1 = add(G2, P2) + result_comm2 = add(P2, G2) + assert result_comm1 == result_comm2 # Doubling result_doubling_G2 = add(G2, G2) assert result_doubling_G2 == multiply(G2, 2) @@ -232,14 +236,14 @@ def case02_add_G2(): yield 'add_G2_bls', [ { "Input": int_to_hex(int(G2[0].coeffs[0]), 64) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(int(G2[0].coeffs[0]), 64) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64), - "Name": "bls_g1add_(g2+g2=2*g2)", + "Name": "bls_g2add_(g2+g2=2*g2)", "Expected": int_to_hex(int(result_doubling_G2[0].coeffs[0]), 64) + int_to_hex(int(result_doubling_G2[0].coeffs[1]), 64) + int_to_hex(int(result_doubling_G2[1].coeffs[0]), 64) + int_to_hex(int(result_doubling_G2[1].coeffs[1]), 64), "Gas": BLS12_G2ADD_GAS, "NoBenchmark": False }, { "Input": int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64), - "Name": "bls_g1add_(g2+g2=2*g2)", + "Name": "bls_g2add_(p2+p2=2*p2)", "Expected": int_to_hex(int(result_doubling_P2[0].coeffs[0]), 64) + int_to_hex(int(result_doubling_P2[0].coeffs[1]), 64) + int_to_hex(int(result_doubling_P2[1].coeffs[0]), 64) + int_to_hex(int(result_doubling_P2[1].coeffs[1]), 64), "Gas": BLS12_G2ADD_GAS, "NoBenchmark": False