Block-sorting compression format.
Overview
A bzip2 stream begins with BZh and a block size digit (1-9, in units of 100 kB). Each block starts with the magic 0x314159265359 and a block CRC; the stream ends with 0x177245385090 and a combined CRC. Blocks are compressed with a Burrows-Wheeler transform, move-to-front, run-length coding and Huffman coding.
Where it is used
- Compressed source tarballs and Unix backups.
History
- Created by Julian Seward in 1996.
Status today
- Declining use in favor of xz and zstd, but still common.
Structures read by the implementation
Offsets are in bytes from the start of the buffer named in each heading. Field names are taken from the implementation and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.
No fixed-offset structures were found in the implementation.
Constants
General Bzip2Decoder
| Name | Value | Type | Notes |
|---|---|---|---|
| BlockMagic | 0x314159265359 | ulong | |
| EndMagic | 0x177245385090 | ulong | |
| OutputChunk | 65536 | int | |
| GroupSize | 50 | int |
Implementation limits reader
| Class | Name | Value | Notes |
|---|---|---|---|
| Bzip2Carver | MinOutputForPartial | 4096 | |
| Bzip2Decoder | MaxGroups | 6 | |
| Bzip2Decoder | MaxAlphabet | 258 | |
| Bzip2Decoder | MaxCodeLength | 20 | |
| Bzip2Decoder | MaxSelectors | 18002 |