cardano::BECH32 class

A static class to encode and decode bytes to and from Bech32 format.

Public static functions

static auto decode(std::string_view str) →  std::pair< std::string, std::vector< uint8_t > > -> auto
Decode a bech32 encoded string to its raw bytes and hrp.
static auto decode_hex(std::string_view str) →  std::pair< std::string, std::string > -> auto
Decode a bech32 encoded string to its raw bytes (as hex string) and hrp.
static auto encode(std::string_view hrp, std::span<const uint8_t> values) →  std::string
Bech32 encode raw bytes and hrp to a string.
static auto encode_hex(std::string_view hrp, std::string_view hex_values) →  std::string
Bech32 encode raw bytes (as hex string) and hrp to a string.

Function documentation

static auto cardano::BECH32::decode(std::string_view str) →  std::pair< std::string, std::vector< uint8_t > >

Decode a bech32 encoded string to its raw bytes and hrp.

Parameters
str The bech32 encoded string to decode.
Returns The decoded raw bytes and hrp.

static auto cardano::BECH32::decode_hex(std::string_view str) →  std::pair< std::string, std::string >

Decode a bech32 encoded string to its raw bytes (as hex string) and hrp.

Parameters
str The bech32 encoded string to decode.
Returns The decoded raw bytes (as hex string) and hrp.

static std::string cardano::BECH32::encode(std::string_view hrp, std::span<const uint8_t> values)

Bech32 encode raw bytes and hrp to a string.

Parameters
hrp The human readable part of the bech32 string.
values The raw bytes to encode.
Returns The encoded bech32 string.

static std::string cardano::BECH32::encode_hex(std::string_view hrp, std::string_view hex_values)

Bech32 encode raw bytes (as hex string) and hrp to a string.

Parameters
hrp The human readable part of the bech32 string.
hex_values The raw bytes to encode (as hex string).
Returns The encoded bech32 string.