示例#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)
示例#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)
示例#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)
示例#4
0
def verify(sig: Signature, msg: Message, pub: Pubkey) -> bool:
    return pair_check(signature_to_G2(sig), msg, pubkey_to_G1(pub))
示例#5
0
文件: test_bls.py 项目: kilic/sol-bls
def test_serializing_g1():
    P = G1
    b = G1_to_pubkey(P)
    assert P == pubkey_to_G1(b)