Search code examples
gzipdeflate

Differences and meanings between gzip header "1f8b0800000000000000" and "1f8b0800000000000003"


As stated in the topic, I am deflating data in my iOS and Android app respectively. The result generated happens to be mostly identical, except that the headers are different.

In iOS, the header is

1f8b0800000000000003

while on Android, the header is

1f8b0800000000000000

Other than this, the remaining parts are identical, I tried to search with both header string but only found results that stating both of them are gzip headers. What are their differences and what would be the possible reason causing them?

Thanks!


Solution

  • GZIP format spec (RFC 1952) says that GZIP member header stores the OS on which the conversion took place, with the intent of describing the filesystem. That's field OS here

    http://www.zlib.org/rfc-gzip.html#header-trailer

    +---+---+---+---+---+---+---+---+---+---+
    |ID1|ID2|CM |FLG|     MTIME     |XFL|OS | (more-->)
    +---+---+---+---+---+---+---+---+---+---+
    

    which matches the position in which you observe the difference.

    0 stands for OS with FAT filesystem, 3 stands for Unix.

    Granted, trying to identify filesystem through identifying OS does not sound like a good idea today, but that's the way it was originally designed.