For the latest stable version, please use Bech32 1.1! |
bech32
local bech32 = require 'bech32'
This module exposes a bech32 codec. The implementation is based on the original
C++ reference implementation, but changes were made to fill user-provided
buffers (instead of relying on memory allocators). The new interface is
friendlier to botan.secure_byte_span
.
Usually it’s not important use secure allocators for bech32 as it’s mostly used
to encode public keys. However that’s not always the case (e.g. nostr’s
nsec1…
addresses). Even if you do use bech32 to encode secrets, it still
doesn’t warrant an excuse to use secure allocators. Nonetheless this module will
always — except for the human-readable part — avoid allocations as a way to be
useful even for those few who need it. If you need to hold bech32 data
exclusively through secure allocations (except for the human-readable
part[1]), you can use this module.