diff options
author | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-09-05 13:30:59 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@protonmail.com> | 2019-09-05 13:31:14 +0200 |
commit | 5667b0d758f119dadc5b41e0bf24e45da1132e54 (patch) | |
tree | 36cb5df578ad79058b87f2f6ff8070deb56dc9a4 /contrib | |
parent | cbde2bc80674ecd27030424f1e125562c97b68bb (diff) | |
parent | 2457aea83c1f9fba708e2335bb197950bf0b6244 (diff) |
Merge #16792: Assert that the HRP is lowercase in Bech32::Encode
2457aea83c1f9fba708e2335bb197950bf0b6244 Assert that the HRP is lowercase in Bech32::Encode (Samuel Dobson)
Pull request description:
From BIP-173:
> The lowercase form is used when determining a character's value for checksum purposes.
> Encoders MUST always output an all lowercase Bech32 string. If an uppercase version of the encoding result is desired, (e.g.- for presentation purposes, or QR code use), then an uppercasing procedure can be performed external to the encoding process.
Currently if HRP contains uppercase characters, the checksum will be generated over these uppercase characters resulting in mixed-case output that will always be invalid even if the case is changed manually after encoding. This shouldn't happen because both prefix's `bc` and `tb` are lowercase currently, but we assert this condition anyway.
This is consistent also with the [C reference implementation](https://github.com/sipa/bech32/blob/2b0aac650ce560fb2b2a2bebeacaa5c87d7e5938/ref/c/segwit_addr.c#L59)
ACKs for top commit:
laanwj:
ACK 2457aea83c1f9fba708e2335bb197950bf0b6244
Tree-SHA512: 24fcbbc2f315c72c550cc3d82b4332443eea6378fc73d571f98b87492604d023378dd102377c9e05467192cae6049606dee98e4c5688c8d5e4caac50c970284b
Diffstat (limited to 'contrib')
0 files changed, 0 insertions, 0 deletions