wire / wire-format / xz-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).
aka: XZ compressed file 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).
| field | size | meaning |
|---|---|---|
| Header magic | 6 bytes | 0xFD 0x37 0x7A 0x58 0x5A 0x00 (FD 7zXZ NUL). |
| Flags | 2 bytes | 1 byte (reserved, must be 0) + 1 byte (check type: 0 none, 1 CRC32, 4 CRC64, 10 SHA-256). |
| Block | variable | Block header (size, flags, filters, compressed size, uncompressed size) + LZMA2 compressed data + integrity check. |
| Index | variable | Number of records + (unpadded size, unpadded size of block) pairs + CRC32 of the index. |
| Footer | 12 bytes | Flags (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 magic | 2 bytes | 0x59 0x5A ('YZ'). |
example:
fd 37 7a 58 5a 00 00 00
XZ header magic + flags (no check type, CRC64 default)
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/xz-format
or /wire-format/xz-format.json