14 #ifndef BITCOIN_BECH32_H 15 #define BITCOIN_BECH32_H 44 std::string
Encode(
Encoding encoding,
const std::string& hrp,
const std::vector<uint8_t>&
values);
57 DecodeResult
Decode(
const std::string& str,
CharLimit limit = CharLimit::BECH32);
60 std::pair<std::string, std::vector<int>>
LocateErrors(
const std::string& str,
CharLimit limit = CharLimit::BECH32);
64 #endif // BITCOIN_BECH32_H static constexpr size_t CHECKSUM_SIZE
static constexpr char SEPARATOR
std::vector< uint8_t > data
The payload (excluding checksum)
std::string Encode(Encoding encoding, const std::string &hrp, const data &values)
Encode a Bech32 or Bech32m string.
static const int64_t values[]
A selection of numbers that do not trigger int64_t overflow when added/subtracted.
DecodeResult(Encoding enc, std::string &&h, std::vector< uint8_t > &&d)
BIP173/350 imposed character limit for Bech32(m) encoded addresses. This guarantees finding up to 4 e...
std::pair< std::string, std::vector< int > > LocateErrors(const std::string &str, CharLimit limit)
Find index of an incorrect character in a Bech32 string.
DecodeResult Decode(const std::string &str, CharLimit limit)
Decode a Bech32 or Bech32m string.
Bech32m encoding as defined in BIP350.
std::string hrp
The human readable part.
Encoding encoding
What encoding was detected in the result; Encoding::INVALID if failed.
CharLimit
Character limits for Bech32(m) encoded strings.