kencode

CompactZeros

Strips leading zero bytes before encoding and restores them on decode.

When the payload starts with a non-zero byte (k=0), the data is returned unchanged. Otherwise a sentinel 0x00 byte followed by a varint count is prepended to the stripped payload. Net overhead: 0 bytes for k=0, +1 byte for k=2, −(k−2) bytes for k≥3.

Functions

Link copied to clipboard
open override fun decode(data: ByteArray): ByteArray

Inverse of encode: restores the original payload after base-decoding.

Link copied to clipboard
open override fun encode(data: ByteArray): ByteArray

Transforms data on the way out, before base-encoding.

Link copied to clipboard

Chains two transforms into a pipeline.

decode

open override fun decode(data: ByteArray): ByteArray(source)

Inverse of encode: restores the original payload after base-decoding.

encode

open override fun encode(data: ByteArray): ByteArray(source)

Transforms data on the way out, before base-encoding.