Encoding arbitrary binary data to Bech32. A Bech32 string consists of:
The last 6 characters of the data-part are an actual checksum of the payload and the prefix, which ensures integrity of the whole string. It also provides bases for an error-detection algorithm, which isn't implemented yet as part of this library.
Importantly, the checksum and the error-detection are most optimal for strings of length smaller than 90 characters. Generating longer strings work, but decreases the efficiency of the checksum in detecting corrupted strings.
Failures that might occur when encoding a value. Can be mostly ignored for well-known prefixes.
UnexpectedCharacterInPrefix: triggered when the prefix contains characters outside of the unicode range [33; 126]. That is, when it contains characters other than:
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Encode a data payload as Bech32 using the given
prefix. Note that we have the following property: