For the latest stable version, please use Bech32 1.1!

bech32.segwit_encode

Synopsis

local bech32 = require 'bech32'

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

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.