bip-0173: test vectors, HRP, and casing requirements updates
* `a12uel5l`: vector added to demonstrate that it and its uppercase version, `A12UEL5L` are both valid and treated as equal. `segwit_addr.bech32_encode('a', [])` * `10a06t8`: vector added to demonstrate that a combined empty HRP and empty data encode to a valid Bech32 string. `segwit_addr.bech32_encode('', [])` * `1qzzfhee`: vector added to demonstrate that an empty HRP encodes to a valid Bech32 string. `segwit_addr.bech32_encode('', [0])` * `pzry9x0s0muk`: vector moved to a new section as it
No reviewsSpecification
-
a12uel5l: vector added to demonstrate that it and its uppercase version,A12UEL5Lare both valid and treated as equal.segwit_addr.bech32_encode('a', []) -
10a06t8: vector added to demonstrate that a combined empty HRP and empty data encode to a valid Bech32 string.segwit_addr.bech32_encode('', []) -
1qzzfhee: vector added to demonstrate that an empty HRP encodes to a valid Bech32 string.segwit_addr.bech32_encode('', [0]) -
pzry9x0s0muk: vector moved to a new section as it is misleading in the current section because "No separator character" can not affect checksum validity because the separator char is not used to compute the checksum.
>>> segwit_addr.bech32_create_checksum('', [1,2,3,4,5,6])
[15, 16, 15, 27, 28, 22]
>>> segwit_addr.bech32_verify_checksum('', [1,2,3,4,5,6]+[15, 16, 15, 27, 28, 22])
True
-
1pzry9x0s0muk: vector removed as incorrect because "Empty HRP" is Bech32 valid -- HRP validity is application specific.segwit_addr.bech32_encode('', [1,2,3,4,5,6]) -
A1g7sgd8andA1G7SGD8: vectors added to verify that implementations adhere to BIP requirement: "The lowercase form is used when determining a character's value for checksum purposes.". Note:
>>> segwit_addr.bech32_encode('a', [])
'a12uel5l'
>>> segwit_addr.bech32_encode('A', [])
'A1g7sgd8' # BUG: violates "The lowercase form is used when determining a character's value for checksum purposes."
10a06t8: test vector added to demonstrate that while a valid Bech32 string, it is segwit application specific invalid.
Discussion (0 threads)
Loading discussions...