Golomb coding is a lossless data compression method using prefix codes optimized for geometric distributions. Rice coding (power-of-2 parameters) is included as a special case.
| Property | Value |
|---|---|
| Category | Compression Algorithms |
| Sub-category | Entropy Coding |
| Security status | Not classified |
| Complexity | Not specified |
| Inventor | Solomon W. Golomb |
| Year | 1966 |
| Origin | πΊπΈ United States |
| Source | algorithms/compression/golomb.js |
Status: not classified β treat as unverified.
No vulnerabilities are recorded for this implementation.
9 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β Empty input
| Field | Value |
|---|---|
input |
(empty) |
expected |
0100000000 |
Vector 2 β Golomb parameter auto-selects m=1 for input=0
| Field | Value |
|---|---|
input |
00 |
expected |
010100000000 |
Vector 3 β Golomb parameter auto-selects m=2 for input=3
| Field | Value |
|---|---|
input |
03 |
expected |
0201000000a0 |
Vector 4 β Sequential integers 0-4
| Field | Value |
|---|---|
input |
0001020304 |
expected |
01050000005bbc |
Vector 5 β Geometric distribution pattern
| Field | Value |
|---|---|
input |
0000010002010003 |
expected |
0108000000269c |
Vector 6 β Powers of 2 sequence
| Field | Value |
|---|---|
input |
01020408 |
expected |
03040000004eb6 |
Vector 7 β Repetitive run (10 bytes) - auto-selected M tracks the mean, keeping the code compact
| Field | Value |
|---|---|
input |
61616161616161616161 |
expected |
430a0000009e9e9e9e9e9e9e9e9e9e |
Vector 8 β Alternating pattern (16 bytes) - two distinct byte values
| Field | Value |
|---|---|
input |
61626162616261626162616261626162 |
expected |
44100000009d9e9d9e9d9e9d9e9d9e9d9e9d9e9d9e |
Vector 9 β Binary/random sample (16 bytes) - non-geometric distribution stress test
| Field | Value |
|---|---|
input |
4080c000000040808000000000000000 |
expected |
1e10000000c6f2bf3800063795e50000000000 |