.XZ
XZ compressed file
Introduction
XZ compresses a single file with the LZMA2 method, which usually gives smaller files
than gzip or bzip2
at the cost of slower compression. Lasse Collin designed the format, and XZ Utils was
released in 2009. Many Linux distributions use it for software packages and source
code releases, often as .tar.xz.
Software
Structure
An XZ file is one or more streams. Each stream is framed by a header and a footer that mirror each other, so a reader can check it from either end.
0Stream header magicFD 37 7A 58 5A 00, stream flags, CRC-3212 bytes12Blocks each a block header, compressed data, padding and a check valuerepeated…Index the compressed and uncompressed size of every blockvaries…Stream footer CRC-32, index size, stream flags, magicYZ12 bytes
The stream flags name the check used on each block’s data: none, CRC-32, CRC-64 or SHA-256. The index lets a reader find any block and jump straight to it, and each block header lists the filters applied, normally LZMA2 and sometimes a filter that makes machine code compress better.