BECH32(3em)
π BECH32(3em) π
okay so bestie, welcome to the BECH32(3em) manual β yes, the manual name is right there, cute. this page is the whole vibe for the bech32 codec. periodt.
β¨ NAME β¨
bech32 β bech32 codec
π SYNOPSIS π
local bech32 = require 'bech32'
bech32.bolt11_encode(output: byte_span, hrp: string, input: byte_span, encoding_variant: "m"|nil) -> byte_span (1)
bech32.bolt11_encode(hrp: string, input: byte_span, encoding_variant: "m"|nil) -> string (2)
π¦ DESCRIPTION π¦
okay so what does it do? it encodes a non-compliant BECH32 variant that is friendlier to BOLT11. literally built different for BOLT11, and the details are giving:
- 8bit groups are not converted into 5bit groups. input is assumed to be already 5bit clean (i.e. itβs assumed that the highest value found in each byte from
inputis0x1F). - MAY exceed the 90-character limit specified in BIP-0173. no cap, it can go past that limit.
so real talk: output should have at least bolt11_encode_output_length(hrp, input) bytes. donβt skimp on the buffer, bestie.
hrp must be all-lower case. lowercase only, iykyk.
input must be 5bit clean. fr fr, no messy bits.
Returns the slice of output that was used to encode the address. slay π
mwah π this iconic page is from Emilua 0.12.1, dated 1980-01-01, and itβs the BECH32(3em) manual. bye bestie π«Ά
π¦ where this page comes from
- nixos 26.05: emilua-bech32 1.1.1
- nixpkgs unstable: emilua-bech32 1.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms