Lossless compression algorithm focused on compression and decompression speed. Uses byte-oriented encoding with tokens for literals and match copies. Optimized for speed over compression ratio.
| Property | Value |
|---|---|
| Category | Compression Algorithms |
| Sub-category | Dictionary-based |
| Security status | Not classified |
| Complexity | Advanced |
| Inventor | Yann Collet |
| Year | 2011 |
| Origin | π«π· France |
| Source | algorithms/compression/lz4.js |
Status: not classified β treat as unverified.
No vulnerabilities are recorded for this implementation.
5 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β Empty input
| Field | Value |
|---|---|
input |
(empty) |
expected |
00000000 |
Vector 2 β Single byte 0x41
| Field | Value |
|---|---|
input |
41 |
expected |
010000001041 |
Vector 3 β All literals, too short for a match - AAAAA
| Field | Value |
|---|---|
input |
4141414141 |
expected |
05000000504141414141 |
Vector 4 β All literals, too short for a match - ABCDABCD
| Field | Value |
|---|---|
input |
4142434441424344 |
expected |
08000000804142434441424344 |
Vector 5 β Text sample with a real match - βthe quick brown foxβ¦β x4
| Field | Value |
|---|---|
input |
74686520717569636b2062726f776e20 666f78206a756d7073206f7665722074 6865206c617a7920646f672e20746865 20717569636b2062726f776e20666f78 206a756d7073206f7665722074686520 6c617a7920646f672e20746865207175 69636b2062726f776e20666f78206a75 6d7073206f76657220746865206c617a 7920646f672e2074686520717569636b 2062726f776e20666f78206a756d7073 206f76657220746865206c617a792064 6f672e20 |
expected |
b4000000f01074686520717569636b20 62726f776e20666f78206a756d707320 6f766572201f00916c617a7920646f67 2e0e000f2d006b50646f672e20 |