BECH32(3em)

πŸ“¦ version 1.1.1, in nixos 26.05, nixpkgs unstable

🌸 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 an output and an input, no cap.
  • (2) bech32.mb_decode(input: byte_span) -> byte_span β€” you pass just an input and get a byte_span back, 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