@@ -15,10 +15,10 @@ namespace
15
15
16
16
typedef std::vector<uint8_t > data;
17
17
18
- /* * The Bech32 character set for encoding. */
18
+ /* * The Bech32 and Bech32m character set for encoding. */
19
19
const char * CHARSET = " qpzry9x8gf2tvdw0s3jn54khce6mua7l" ;
20
20
21
- /* * The Bech32 character set for decoding. */
21
+ /* * The Bech32 and Bech32m character set for decoding. */
22
22
const int8_t CHARSET_REV[128 ] = {
23
23
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
24
24
-1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 , -1 ,
@@ -150,8 +150,8 @@ data CreateChecksum(Encoding encoding, const std::string& hrp, const data& value
150
150
151
151
/* * Encode a Bech32 or Bech32m string. */
152
152
std::string Encode (Encoding encoding, const std::string& hrp, const data& values) {
153
- // First ensure that the HRP is all lowercase. BIP-173 requires an encoder
154
- // to return a lowercase Bech32 string, but if given an uppercase HRP, the
153
+ // First ensure that the HRP is all lowercase. BIP-173 and BIP350 require an encoder
154
+ // to return a lowercase Bech32/Bech32m string, but if given an uppercase HRP, the
155
155
// result will always be invalid.
156
156
for (const char & c : hrp) assert (c < ' A' || c > ' Z' );
157
157
data checksum = CreateChecksum (encoding, hrp, values);
0 commit comments