Skip to content

Commit 0334602

Browse files
fjahrsipa
authored andcommitted
naming nits
1 parent 2e7c80f commit 0334602

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/bech32.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ namespace
1515

1616
typedef std::vector<uint8_t> data;
1717

18-
/** The Bech32 character set for encoding. */
18+
/** The Bech32 and Bech32m character set for encoding. */
1919
const char* CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l";
2020

21-
/** The Bech32 character set for decoding. */
21+
/** The Bech32 and Bech32m character set for decoding. */
2222
const int8_t CHARSET_REV[128] = {
2323
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
2424
-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
150150

151151
/** Encode a Bech32 or Bech32m string. */
152152
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
155155
// result will always be invalid.
156156
for (const char& c : hrp) assert(c < 'A' || c > 'Z');
157157
data checksum = CreateChecksum(encoding, hrp, values);

src/bech32.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

5-
// Bech32 is a string encoding format used in newer address types.
6-
// The output consists of a human-readable part (alphanumeric), a
7-
// separator character (1), and a base32 data section, the last
8-
// 6 characters of which are a checksum.
5+
// Bech32 and Bech32m are string encoding formats used in newer
6+
// address types. The outputs consist of a human-readable part
7+
// (alphanumeric), a separator character (1), and a base32 data
8+
// section, the last 6 characters of which are a checksum. The
9+
// module is namespaced under bech32 for historical reasons.
910
//
1011
// For more information, see BIP 173 and BIP 350.
1112

@@ -40,7 +41,7 @@ struct DecodeResult
4041
DecodeResult(Encoding enc, std::string&& h, std::vector<uint8_t>&& d) : encoding(enc), hrp(std::move(h)), data(std::move(d)) {}
4142
};
4243

43-
/** Decode a Bech32 string. */
44+
/** Decode a Bech32 or Bech32m string. */
4445
DecodeResult Decode(const std::string& str);
4546

4647
} // namespace bech32

0 commit comments

Comments
 (0)