Functions
getBaseXResliceEncoder
getBaseXResliceEncoder(
alphabet
,bits
):VariableSizeEncoder
<string
>
Returns an encoder for base-X encoded strings using bit re-slicing.
This encoder serializes strings by dividing the input into custom-sized bit chunks, mapping them to an alphabet, and encoding the result into a byte array. This approach is commonly used for encoding schemes where the alphabet's length is a power of 2, such as base-16 or base-64.
For more details, see getBaseXResliceCodec.
Parameters
Parameter | Type | Description |
---|---|---|
alphabet | string | The set of characters defining the base-X encoding. |
bits | number | The number of bits per encoded chunk, typically log2(alphabet.length) . |
Returns
VariableSizeEncoder
<string
>
A VariableSizeEncoder<string>
for encoding base-X strings using bit re-slicing.
Example
Encoding a base-X string using bit re-slicing.