DEFLATE
DEFLATE is a lossless compressed-data format combining length-distance references and Huffman coding, with an additional uncompressed block form.
Compressed blocks use fixed or dynamic Huffman codes; stored blocks carry uncompressed bytes. Match lengths are 3-258 bytes and backward distances are 1-32768 bytes. The distance limit bounds history, not stream length. Only stored blocks have a 65535-byte data limit. [1]
Raw DEFLATE has no wrapper payload checksum. The zlib format adds Adler-32 and can identify a preset dictionary; gzip adds a member header, CRC32 and uncompressed size modulo 2^32. These formats are not interchangeable decoder inputs. [2] [3]
A match can overlap the output it creates. A length 5 at distance 2 after XY appends XYXYX. Decoding therefore needs evolving history, not just a frozen copy of earlier bytes. [1]
zlib Z_SYNC_FLUSH byte-aligns output but retains history. Z_FULL_FLUSH also resets history for later decoding. Both emit 00 00 ff ff; inflateSync finds only a candidate, not a certified restart. [5]
In synthetic native-zlib controls, the full-flush suffix decoded correctly; the sync-flush suffix failed without history. A literal marker inside stored data even led to Z_STREAM_END with no input left, but yielded DECOY instead of the original payload. Decoder completion alone cannot establish the original boundary. [6]
Rapidgzip accepts prefetched chunks by the preceding chunk's actual end offset. Its seek index retains bit offsets, decoded offsets and history windows. Plausible block discovery and validated stream position are separate steps. [7]
Relations
- related
- Gzip, Compression dictionary, Block-independent compression, ZIP archive, Checksum, Lossless compression, Huffman coding, LZ77, Adler-32
Limitations
- Huffman coding is block-local, but references can cross block boundaries; locating a block does not guarantee independent decoding. [1]
- A wrapper checksum can detect corruption only when checked; RFC 1952 permits a compliant gzip decoder to skip its trailer. It does not authenticate the archive. [2] [3]
Citations
- RFC 1951: DEFLATE format, sections 2 and 3.2-3.3 (Informational, May 1996)
- RFC 1950: zlib wrapper, dictionary identifier and Adler-32, section 2.2
- RFC 1952: gzip member header and trailer, section 2.3.1
- zlib 1.3 API: deflate flush modes and inflateSync candidate search
- Hesela: native zlib restart controls, results and reproduction instructions
- Knespel and Brunst: Rapidgzip (HPDC 2023), sections 1.2-1.3 and 3
Further reading
Sources & caveats
- Primary-format synthesis, not a performance benchmark or a historical claim about first implementation. RFC 1951 is Informational.
- Restart controls use synthetic raw-DEFLATE inputs and native zlib 1.3, not a Rapidgzip benchmark or a measurement of corruption frequency.