Aggregate G2 point at infinity

This commit is contained in:
Hsiao-Wei Wang 2020-09-25 14:40:42 +08:00
parent 19d6c8336a
commit bdbd2aae37
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 11 additions and 1 deletions

View File

@ -161,9 +161,11 @@ def case02_verify():
def case03_aggregate(): def case03_aggregate():
for message in MESSAGES: for message in MESSAGES:
sigs = [bls.Sign(privkey, message) for privkey in PRIVKEYS] sigs = [bls.Sign(privkey, message) for privkey in PRIVKEYS]
aggregate_sig = bls.Aggregate(sigs)
assert aggregate_sig == milagro_bls.Aggregate(sigs)
yield f'aggregate_{encode_hex(message)}', { yield f'aggregate_{encode_hex(message)}', {
'input': [encode_hex(sig) for sig in sigs], 'input': [encode_hex(sig) for sig in sigs],
'output': encode_hex(bls.Aggregate(sigs)), 'output': encode_hex(aggregate_sig),
} }
# Invalid pubkeys -- len(pubkeys) == 0 # Invalid pubkeys -- len(pubkeys) == 0
@ -175,6 +177,14 @@ def case03_aggregate():
'output': None, 'output': None,
} }
# Valid to aggregate G2 point at infinity
aggregate_sig = bls.Aggregate([Z2_SIGNATURE])
assert aggregate_sig == milagro_bls.Aggregate([Z2_SIGNATURE]) == Z2_SIGNATURE
yield f'aggregate_infinity_signature', {
'input': [Z2_SIGNATURE],
'output': aggregate_sig,
}
def case04_fast_aggregate_verify(): def case04_fast_aggregate_verify():
for i, message in enumerate(MESSAGES): for i, message in enumerate(MESSAGES):