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