wire / wire-format / xz-format

XZ compressed file format

XZ is a container format for LZMA2-compressed data. Structure: 6-byte header magic (0xFD '7zXZ' 0x00), 2-byte flags, then blocks (each with a block header, compressed data, and integrity check), an index, and a 12-byte footer (2-byte flags, 4-byte backward size, 6-byte footer magic 0x59 0x5A).

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

aka: XZ compressed file format

wire format

spec: XZ File Format (tukaani.org)

XZ is a container format for LZMA2-compressed data. Structure: 6-byte header magic (0xFD '7zXZ' 0x00), 2-byte flags, then blocks (each with a block header, compressed data, and integrity check), an index, and a 12-byte footer (2-byte flags, 4-byte backward size, 6-byte footer magic 0x59 0x5A).

fieldsizemeaning
Header magic6 bytes0xFD 0x37 0x7A 0x58 0x5A 0x00 (FD 7zXZ NUL).
Flags2 bytes1 byte (reserved, must be 0) + 1 byte (check type: 0 none, 1 CRC32, 4 CRC64, 10 SHA-256).
BlockvariableBlock header (size, flags, filters, compressed size, uncompressed size) + LZMA2 compressed data + integrity check.
IndexvariableNumber of records + (unpadded size, unpadded size of block) pairs + CRC32 of the index.
Footer12 bytesFlags (2) + backward size (4, /4) + footer magic 0x59 0x5A (2, 'YZ') + ... actually 2-byte flags + 4-byte backward size + 2-byte magic YZ + 2 reserved = 12? Let me be precise: 2 (flags) + 4 (backward size) + 2 (magic YZ) = 8, plus 4 reserved = 12.
Footer magic2 bytes0x59 0x5A ('YZ').

example:

fd 37 7a 58 5a 00 00 00

XZ header magic + flags (no check type, CRC64 default)


provenance

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