Skip to content

Compression Mode 03 — Decimal Integer Packing since v1.0.0

This compression mode operates on decimal non-negative integers.

It converts each digit in an integer to a nibble (4 bits) and it also converts decimal representation of hexadecimal digits (except for 15/F) to nibbles. This means that 10 (A), 11 (B), 12 (C), 13 (D), and 14 (E) are single digits, not two. 15 is converted as two digits since F is used for padding for correct UTF-16 output, so actually internally it operates on base-15.

To avoid confusion

This mode operates on decimal input only, not hexadecimal, not base-15 — Input should only contain these characters: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9.

How It Works

Encoding Table

DecimalEncoded digitBinary
000000
110001
220010
330011
440100
550101
660110
770111
881000
991001
10A1010
11B1011
12C1100
13D1101
14E1110
(padding)F1111