You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When bech32Encode is called with a human-readable part that contains one or more upper-case characters, it produces in an invalid Bech32 string that cannot be decoded with the bech32Decode function.
Analysis
As part of the encoding process, the human-readable part is converted to lower case:
Overview
When
bech32Encode
is called with a human-readable part that contains one or more upper-case characters, it produces in an invalid Bech32 string that cannot be decoded with thebech32Decode
function.Analysis
As part of the encoding process, the human-readable part is converted to lower case:
bech32/ref/haskell/src/Codec/Binary/Bech32.hs
Line 85 in a4e672d
However, the checksum is calculated before the conversion to lower case takes place:
bech32/ref/haskell/src/Codec/Binary/Bech32.hs
Line 83 in a4e672d
This contradicts the Bech32 specification, which states:
Therefore, if the original human-readable part contains one or more upper case characters:
Example
Consider the following two calls to
bech32Encode
, differing only in the case of the human-readable part:Expected Behaviour
Both calls to
bech32Encode
should result in the same output string:Actual Behaviour
The above calls to
bech32Encode
actually result in different output strings:Attempting to decode the string produced by
bech32Encode "TEST" []
results inNothing
:The text was updated successfully, but these errors were encountered: