Example #1
0
def verify_agg(sig: Signature, msgs: Sequence[Message],
               pubs: Sequence[Pubkey]) -> bool:
    _pubs = []
    for pub in pubs:
        _pubs.append(pubkey_to_G1(pub))
    return pair_check_multiple(signature_to_G2(sig), _pubs, msgs)
Example #2
0
def verify_agg_common_msg(sig: Signature, msg: Message,
                          pubs: Sequence[Pubkey]) -> bool:
    aggregated_pub = Z1
    for pub in pubs:
        aggregated_pub = add(aggregated_pub, pubkey_to_G1(pub))
    return pair_check(signature_to_G2(sig), msg, aggregated_pub)
Example #3
0
def agg_pubs(pubs: Sequence[Pubkey]) -> Signature:
    aggregated = Z2
    for pub in pubs:
        aggregated = add(aggregated, pubkey_to_G1(pub))
    return G1_to_pubkey(aggregated)
Example #4
0
def verify(sig: Signature, msg: Message, pub: Pubkey) -> bool:
    return pair_check(signature_to_G2(sig), msg, pubkey_to_G1(pub))
Example #5
0
def test_serializing_g1():
    P = G1
    b = G1_to_pubkey(P)
    assert P == pubkey_to_G1(b)