From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "struct" |
|---|
| subject | "Format:Gzip" |
|---|
| claim | "A gzip member starts with a 10-byte header: 1F 8B, CM 8, FLG, u32 MTIME (LE), XFL, OS; optional fields follow as flagged, then raw deflate data and an 8-byte trailer (u32 CRC-32 and u32 ISIZE, little endian). zlib's deflate with windowBits 31 writes 1F 8B 08 00 00000000 00 0A for 'hello' on Windows and ends with 86 A6 10 36 05 00 00 00." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Gzip" |
|---|
| observed_in | | "Python 3.11 zlib 1.3.2 (Windows) and the Python gzip module" |
|
|---|
|
|---|
| data | | name | "gzip_header" |
|---|
| size | "0xA" |
|---|
| fields | | offset | "0x0" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "id1" |
|---|
| notes | "0x1F" |
|---|
|
| offset | "0x1" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "id2" |
|---|
| notes | "0x8B" |
|---|
|
| offset | "0x2" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "cm" |
|---|
| notes | "8 = deflate" |
|---|
|
| offset | "0x3" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "flg" |
|---|
| bits | |
|
|
|
|
| bit | "5-7" |
|---|
| name | "reserved" |
|---|
| notes | "must be zero" |
|---|
|
|
|---|
|
| offset | "0x4" |
|---|
| size | 4 |
|---|
| type | "uint32_t" |
|---|
| name | "mtime" |
|---|
| notes | "Unix time, little endian, 0 = none" |
|---|
|
| offset | "0x8" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "xfl" |
|---|
| notes | "2 = best compression, 4 = fastest" |
|---|
|
| offset | "0x9" |
|---|
| size | 1 |
|---|
| type | "uint8_t" |
|---|
| name | "os" |
|---|
| notes | "see the gzip OS enum" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "documentation" |
|---|
| detail | "RFC 1952 section 2.3" |
|---|
|
| type | "source" |
|---|
| detail | "put_byte 31, 139, 8, flags, mtime, XFL (level 9: 2, level < 2 or strategy >= Z_HUFFMAN_ONLY: 4, else 0), OS_CODE" |
|---|
| repo | "https://github.com/madler/zlib" |
|---|
| commit | "767c4c947852e143f582c85f14cf573411df1b35" |
|---|
| path | "deflate.c" |
|---|
| lines | "1066-1082" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "compressobj(6, DEFLATED, 31) on b'hello': 1f 8b 08 00 00 00 00 00 00 0a cb 48 cd c9 c9 07 00 86 a6 10 36 05 00 00 00; level 1 and 9 give XFL 04 and 02." |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "gzip member header" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T05:49:44.984Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T12:11:54.608Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read zlib deflate.c at 767c4c9 lines 1066-1082: put_byte 31,139,8 then flags/mtime/XFL (level 9 -> 2, strategy>=Z_HUFFMAN_ONLY or level<2 -> 4, else 0) and OS_CODE; 10-byte layout matches the fact. The gzhead branch is where optional fields (flag bits) are added." |
|---|
|
|
|---|