zlib

From Just Solve the File Format Problem
Revision as of 16:12, 18 August 2022 by Jsummers (Talk | contribs)

Jump to: navigation, search
File Format
Name zlib
Ontology
Released 1995

zlib format is a variant of the DEFLATE compressed data format. It adds a lightweight container, a small amount of configurability, and error checking.

zlib is also the name of a software library that supports the zlib format, and other formats related to DEFLATE.

There are many formats and protocols that use, or may use, zlib format. A notable example is PNG.

Contents

See also

Identification

The first two bytes can help to identify a zlib datastream. The following tests are ordered from most reliable to least reliable.

  • If the first two bytes are interpreted as a big-endian integer, it is always a multiple of 31. (Always true)
  • The first byte has eight possible values: 0x08, 0x18, 0x28, ..., 0x78. (Always true, unless the zlib format has been extended to support compression methods other than Deflate.)
  • The 0x20 bit of the second byte is 0. (A value of 1 is legal in zlib v3.3+, but indicates use of a preset dictionary, so the zlib stream is not portable.)
  • The first byte is exactly 0x78. (Any other value from the list above means the Deflate decompressor can use a window size less than the standard 32K. The extent to which this feature has been used is unclear.)

Specifications

  • ZLIB Specification v3.1 - No copy found. There are dead links to it in e.g. the zlib 0.95 README file.
  • ZLIB Specification v3.2 (from archive.org)
  • RFC 1950: ZLIB Compressed Data Format Specification version 3.3

Software

See also DEFLATE#Software.

Links

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox