bech32.segwit_decode

Synopsis

local bech32 = require 'bech32'

bech32.segwit_decode(output: byte_span, input: byte_span|string) -> string, integer, byte_span (1)
bech32.segwit_decode(input: byte_span|string) -> string, integer, byte_span (2)

Description

Decode a SegWit address.

output should have at least segwit_decode_output_length(input) bytes.

Returns a tuple with the following elements:

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

  • The witness version.

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