bech32.mb_encode

Synopsis

local bech32 = require 'bech32'

bech32.mb_encode(output: byte_span, input: byte_span) (1)
bech32.mb_encode(input: byte_span) -> byte_span (2)

Description

Repack bits.

Perform 8bit groups to 5bit groups conversion where each group — either 5bit or 8bit — is encoded as a single byte. 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). 8bit groups concatenate the lower bits from consecutive byte-encoded 5bit groups to create each byte (the value 0 is used as padding if necessary).