BECH32(3em)
πΈ NAME πΈ
okay so welcome to BECH32(3em), bestie β this is the page for the bech32 codec, and yes I folded the manual name in cutely instead of copy-pasting the header line π
bech32 β bech32 codec, periodt.
β¨ SYNOPSIS β¨
local bech32 = require 'bech32'
bech32.mb_decode(output: byte_span, input: byte_span) (1)
bech32.mb_decode(input: byte_span) -> byte_span (2)
so you start with local bech32 = require 'bech32', then pick your fighter:
- (1)
bech32.mb_decode(output: byte_span, input: byte_span)β you pass in anoutputand aninput, no cap. - (2)
bech32.mb_decode(input: byte_span) -> byte_spanβ you pass just aninputand get abyte_spanback, iconic.
π DESCRIPTION π
the whole assignment is literally repack bits π«Ά
it performs 5bit groups to 8bit groups conversion, where each group β either 5bit or 8bit β is encoded as a single byte. the 5bit groups only use the lower bits of a byte, meaning the highest possible value in each byte for the 5bit groups bytestream will be 0x1F π₯ the 8bit groups concatenate the lower bits from consecutive byte-encoded 5bit groups to create each byte, and the value 0 is used as padding if necessary β¨
it raises an error on incomplete input β like a missing 5bit group to finish the last 8bit group, non-zero bits in the padding bits of a 5bit group, ... yeah those vibes ππ
xoxo, this page was brought to you by Emilua 0.12.1, dated 1980-01-01 β BECH32(3em) out π
π
π¦ 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