Skip to content

Commit

Permalink
add G2
Browse files Browse the repository at this point in the history
  • Loading branch information
asanso committed Mar 4, 2024
1 parent 0b69016 commit 97e2c6b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 97e2c6b

Please sign in to comment.