bech32.encode

Synopsis

local bech32 = require 'bech32'

bech32.encode(output: byte_span, hrp: string, input: byte_span, encoding_variant: "m"|nil) -> byte_span (1)
bech32.encode(hrp: string, input: byte_span, encoding_variant: "m"|nil) -> string (2)

Description

Encode a Bech32 or Bech32m string.

output should have at least 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.