From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:LZ4" |
|---|
| claim | "An LZ4 block is a list of sequences: token byte (high nibble literal count, low nibble match length - 4; 15 in either means extra length bytes follow, added while each is 255), the literals, a uint16 LE offset back into the output (1-65535, 0 invalid; may overlap the bytes being written), then the match length extra bytes. The last sequence holds only literals and has no offset." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:LZ4" |
|---|
| observed_in | |
|---|
|
|---|
| data | | effect | "block decoding" |
|---|
| test_vectors | | input | "FF 0B 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 7A 78 79 7A 1A 00 FF FF FF E1 50 76 7A 78 79 7A" |
|---|
| expected | "1040 bytes: 'abcdefghijklmnopqrstuvzxyz' repeated (26 literals, a 1009-byte match at offset 26), then 'vzxyz' (block of repeat.txt.lz4)" |
|---|
|
| input | "1F 61 01 00 06 50 62 62 62 62 62" |
|---|
| expected | "'a' x 26 + 'bbbbb' (offset 1, match length 15 + 6 + 4 = 25)" |
|---|
|
| input | "00" |
|---|
| expected | "empty output (a valid empty block)" |
|---|
|
|
|---|
| samples | | url | "https://raw.githubusercontent.com/pierrec/lz4/03e7a7b8979e18bc4443d4cd685c594ddb398bb5/testdata/repeat.txt.lz4" |
|---|
| sha256 | "b38e708dfe967d53d25fdbdd0053ff21da92e6b403acf943df4d78ae454b33b6" |
|---|
| note | "59-byte frame from the C lz4 tool; its block is the first test vector" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "token, literal length 15 + 255-continued bytes, little-endian 2-byte offset (0 invalid, max 65535), matchlength low nibble + minmatch 4, overlapping copies" |
|---|
| repo | "https://github.com/lz4/lz4" |
|---|
| commit | "aa787570e681c695fc087b4a44cd2d5b38c2289a" |
|---|
| path | "doc/lz4_Block_format.md" |
|---|
| lines | "25-111" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "Vectors decoded with Code:LZ4/LZ4 codec and frame scanner (Python); the first is the block of repeat.txt.lz4 (pierrec/lz4 testdata), whose output matches repeat.txt and the frame's content checksum 0x70938B91." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "Sequence encoding" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T17:53:41.908Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T09:22:46.604Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read doc/lz4_Block_format.md at aa78757 (token, 255-continued lengths, 2-byte LE offset, 0 invalid, minmatch 4, overlap, last sequence literals only). Spec only; did not read lz4.c decoder." |
|---|
|
|
|---|