For the latest stable version, please use Bech32 1.1!

bech32.decode

Synopsis

local bech32 = require 'bech32'

bech32.decode(output: byte_span, input: byte_span|string) -> string, byte_span, "m"|nil

Description

Decode a Bech32 or Bech32m string.

output should have at least decode_output_length(input) bytes.

Returns a tuple with the following elements:

  • The lower-case version of the human-readable part.

  • The slice of output that was used to decode the bech32 address.

  • The encoding variant (or nil on none).