move desription to human readable name

This commit is contained in:
Danny Ryan 2020-02-06 13:02:16 -06:00
parent f5723cdd93
commit b57b4f5e0d
No known key found for this signature in database
GPG Key ID: 2765A792E42CE07A
1 changed files with 12 additions and 12 deletions

View File

@ -69,8 +69,8 @@ def case02_verify():
# Valid signature # Valid signature
signature = bls.G2ProofOfPossession.Sign(privkey, message) signature = bls.G2ProofOfPossession.Sign(privkey, message)
pubkey = bls.G2ProofOfPossession.PrivToPub(privkey) pubkey = bls.G2ProofOfPossession.PrivToPub(privkey)
full_name = f'{encode_hex(pubkey)}_{encode_hex(message)}_valid' full_name = f'{encode_hex(pubkey)}_{encode_hex(message)}'
yield f'verify_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'verify_valid_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkey': encode_hex(pubkey), 'pubkey': encode_hex(pubkey),
'message': encode_hex(message), 'message': encode_hex(message),
@ -81,8 +81,8 @@ def case02_verify():
# Invalid signatures -- wrong pubkey # Invalid signatures -- wrong pubkey
wrong_pubkey = bls.G2ProofOfPossession.PrivToPub(PRIVKEYS[(i + 1) % len(PRIVKEYS)]) wrong_pubkey = bls.G2ProofOfPossession.PrivToPub(PRIVKEYS[(i + 1) % len(PRIVKEYS)])
full_name = f'{encode_hex(wrong_pubkey)}_{encode_hex(message)}_wrong_pubkey' full_name = f'{encode_hex(wrong_pubkey)}_{encode_hex(message)}'
yield f'verify_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'verify_wrong_pubkey_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkey': encode_hex(wrong_pubkey), 'pubkey': encode_hex(wrong_pubkey),
'message': encode_hex(message), 'message': encode_hex(message),
@ -93,8 +93,8 @@ def case02_verify():
# Invalid signature -- tampered with signature # Invalid signature -- tampered with signature
tampered_signature = signature[:-4] + b'\xFF\xFF\xFF\xFF' tampered_signature = signature[:-4] + b'\xFF\xFF\xFF\xFF'
full_name = f'{encode_hex(pubkey)}_{encode_hex(message)}_tampered_signature' full_name = f'{encode_hex(pubkey)}_{encode_hex(message)}'
yield f'verify_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'verify_tampered_signature_case_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkey': encode_hex(pubkey), 'pubkey': encode_hex(pubkey),
'message': encode_hex(message), 'message': encode_hex(message),
@ -122,8 +122,8 @@ def case04_fast_aggregate_verify():
pubkeys_serial = [encode_hex(pubkey) for pubkey in pubkeys] pubkeys_serial = [encode_hex(pubkey) for pubkey in pubkeys]
# Valid signature # Valid signature
full_name = f'{pubkeys_serial}_{encode_hex(message)}_valid' full_name = f'{pubkeys_serial}_{encode_hex(message)}'
yield f'fast_aggregate_verify_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'fast_aggregate_verify_valid_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkeys': pubkeys_serial, 'pubkeys': pubkeys_serial,
'message': encode_hex(message), 'message': encode_hex(message),
@ -135,8 +135,8 @@ def case04_fast_aggregate_verify():
# Invalid signature -- extra pubkey # Invalid signature -- extra pubkey
pubkeys_extra = pubkeys + [bls.G2ProofOfPossession.PrivToPub(PRIVKEYS[-1])] pubkeys_extra = pubkeys + [bls.G2ProofOfPossession.PrivToPub(PRIVKEYS[-1])]
pubkeys_extra_serial = [encode_hex(pubkey) for pubkey in pubkeys_extra] pubkeys_extra_serial = [encode_hex(pubkey) for pubkey in pubkeys_extra]
full_name = f'{pubkeys_extra_serial}_{encode_hex(message)}_extra_pubkey' full_name = f'{pubkeys_extra_serial}_{encode_hex(message)}'
yield f'fast_aggregate_verify_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'fast_aggregate_verify_extra_pubkey_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkeys': pubkeys_extra_serial, 'pubkeys': pubkeys_extra_serial,
'message': encode_hex(message), 'message': encode_hex(message),
@ -147,8 +147,8 @@ def case04_fast_aggregate_verify():
# Invalid signature -- tampered with signature # Invalid signature -- tampered with signature
tampered_signature = aggregate_signature[:-4] + b'\xff\xff\xff\xff' tampered_signature = aggregate_signature[:-4] + b'\xff\xff\xff\xff'
full_name = f'{pubkeys_serial}_{encode_hex(message)}_tampered_signature' full_name = f'{pubkeys_serial}_{encode_hex(message)}'
yield f'fast_aggregate_verify_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', { yield f'fast_aggregate_verify_tampered_signature_{(hash(bytes(full_name, "utf-8"))[:8]).hex()}', {
'input': { 'input': {
'pubkeys': pubkeys_serial, 'pubkeys': pubkeys_serial,
'message': encode_hex(message), 'message': encode_hex(message),