Bitcoin Core  22.99.0
P2P Digital Currency
Classes | Enumerations | Functions
bech32 Namespace Reference

Classes

struct  DecodeResult
 

Enumerations

enum  Encoding { Encoding::INVALID, Encoding::BECH32, Encoding::BECH32M }
 

Functions

std::string Encode (Encoding encoding, const std::string &hrp, const data &values)
 Encode a Bech32 or Bech32m string. More...
 
DecodeResult Decode (const std::string &str)
 Decode a Bech32 or Bech32m string. More...
 
std::string LocateErrors (const std::string &str, std::vector< int > &error_locations)
 Find index of an incorrect character in a Bech32 string. More...
 
std::string Encode (Encoding encoding, const std::string &hrp, const std::vector< uint8_t > &values)
 Encode a Bech32 or Bech32m string. More...
 

Enumeration Type Documentation

◆ Encoding

enum bech32::Encoding
strong
Enumerator
INVALID 

Failed decoding.

BECH32 

Bech32 encoding as defined in BIP173.

BECH32M 

Bech32m encoding as defined in BIP350.

Definition at line 24 of file bech32.h.

Function Documentation

◆ Decode()

DecodeResult bech32::Decode ( const std::string &  str)

Decode a Bech32 or Bech32m string.

Definition at line 480 of file bech32.cpp.

Here is the caller graph for this function:

◆ Encode() [1/2]

std::string bech32::Encode ( Encoding  encoding,
const std::string &  hrp,
const data &  values 
)

Encode a Bech32 or Bech32m string.

Definition at line 464 of file bech32.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Encode() [2/2]

std::string bech32::Encode ( Encoding  encoding,
const std::string &  hrp,
const std::vector< uint8_t > &  values 
)

Encode a Bech32 or Bech32m string.

If hrp contains uppercase characters, this will cause an assertion error. Encoding must be one of BECH32 or BECH32M.

◆ LocateErrors()

std::string bech32::LocateErrors ( const std::string &  str,
std::vector< int > &  error_locations 
)

Find index of an incorrect character in a Bech32 string.

Return the positions of errors in a Bech32 string.

Definition at line 507 of file bech32.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: