yabase/bech32

Values

pub fn decode(
  input: String,
) -> Result(encoding.Bech32Decoded, encoding.CodecError)

Decode a Bech32 or Bech32m string, auto-detecting the variant. Per BIP 173: total length <= 90, HRP length 1..83.

pub fn encode(
  hrp: String,
  data: BitArray,
) -> Result(String, encoding.CodecError)

Encode data with Bech32 (BIP 173). hrp: human-readable part (e.g. “bc” for Bitcoin mainnet). data: the raw data bytes to encode.

pub fn encode_m(
  hrp: String,
  data: BitArray,
) -> Result(String, encoding.CodecError)

Encode data with Bech32m (BIP 350).

Search Document