Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Coding Enthusiast on April 24, 2019, 01:40:57 PM



Title: How are BIP173 test vectors "valid"?
Post by: Coding Enthusiast on April 24, 2019, 01:40:57 PM
There are 7 test vectors at the top of the list (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#test-vectors) that are supposed to be "valid Bech32" but I can't see how they are valid.
These have no data since the bytes after the separator is the 6 byte checksum:
A12UEL5L
a12uel5l
an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharacter sbio1tt5tgs
?1ezyfcl


These have data but none of them are properly padded! They all have leftover non-zero bites (3 or 5)!
abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw
11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqc8247j
split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w


I can get the first group being valid since that is just encoding of empty data (which is not SegWit address and just encoding) but the second group doesn't make sense, shouldn't the data be properly padded in those too?


Title: Re: How are BIP173 test vectors "valid"?
Post by: aliashraf on April 24, 2019, 02:40:35 PM
I don't see anything wrong with these test vectors:
A12UEL5L
a12uel5l
an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharacter sbio1tt5tgs
?1ezyfcl
(empty data part, blue HRP, green checksum)

abcdef1qpzry9x8gf2tvdw0s3jn54khce6mua7lmqqqxw
11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq qqqqqc8247j
split1checkupstagehandshakeupstreamerranterredcaperred2y9e3w
(red data part, blue HRP, green checksum)

Bech32 encoding is relaxed about padding, segwit address format requires padding when applicable, these test vectors are not segwit addresses, just some arbitrary bech32 encoded strings.





Title: Re: How are BIP173 test vectors "valid"?
Post by: Coding Enthusiast on April 24, 2019, 04:12:05 PM
Bech32 encoding is relaxed about padding,

That is the part missing from the bip...