bech32.segwit_encode

Synopsis

local bech32 = require 'bech32'

bech32.segwit_encode(output: byte_span, hrp: string, witver: integer, input: byte_span) -> byte_span (1)
bech32.segwit_encode(hrp: string, witver: integer, input: byte_span) -> string (2)

Description

Encode a SegWit address.

output should have at least segwit_encode_output_length(hrp, input) bytes.

hrp must be all-lower case.

Returns the slice of output that was used to encode the bech32 address.