wire / wire-format / zlib-format

zlib compressed data format (RFC 1950)

zlib wraps a DEFLATE stream with a 2-byte header (CMF + FLG) and a 4-byte Adler-32 trailer. The header encodes the compression method (always 8 = DEFLATE), window size, and flags. The FLG byte's high 4 bits must make (CMF*256 + FLG) a multiple of 31.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: zlib compressed data format (RFC 1950)

wire format

spec: RFC 1950

zlib wraps a DEFLATE stream with a 2-byte header (CMF + FLG) and a 4-byte Adler-32 trailer. The header encodes the compression method (always 8 = DEFLATE), window size, and flags. The FLG byte's high 4 bits must make (CMF*256 + FLG) a multiple of 31.

fieldsizemeaning
CMF1 byteCompression Method and Flags: low 4 bits = CM (8 = DEFLATE), high 4 bits = CINFO (log2(window size) - 8, so 7 = 32KB window).
FLG1 byteFlags: bits 0-4 = FCHECK (makes CMF*256+FLG divisible by 31), bit 5 = FDICT (preset dictionary), bits 6-7 = FLEVEL (compression level).
Dictionary ID4 bytesPresent only if FDICT is set; Adler-32 of the preset dictionary.
Compressed datavariableDEFLATE bitstream.
Adler-324 bytesAdler-32 checksum of the uncompressed data (big-endian).

example:

78 9c 03 00 00 00 00 01

zlib header (CMF=0x78 DEFLATE/32KB, FLG=0x9C) + empty stored block + Adler-32 of empty (0x00000001)


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/zlib-format or /wire-format/zlib-format.json