iczelia
A better and stronger spiritual successor to BZip2.
| 2026-11-10 22:37 | progress on #160, #152, #143. | Kamila Szewczyk |
| 2026-11-10 21:12 | reorganise the code | Kamila Szewczyk |
| 2026-11-10 02:07 | remove RLE from the encoder paths | Kamila Szewczyk |
| 2026-11-09 23:59 | runtime kernel detection | Kamila Szewczyk |
| 2026-11-09 23:23 | v1.5.6 | Kamila Szewczyk |
| 2026-10-22 17:50 | install pkg-config in ci | Kamila Szewczyk |
| 2026-10-22 17:29 | fix #193 | Kamila Szewczyk |
| 2026-10-22 10:32 | v1.5.5 | Kamila Szewczyk |
| 2026-10-18 10:37 | fix #191, #192 | Kamila Szewczyk |
| 2026-10-14 06:17 | stricter checks at boundaries for bz3_decode and cli | Kamila Szewczyk |
| master (2026-11-10 22:37) | e8e9 (2022-07-31 14:45) |
| 1.5.5 (2026-10-22 10:32) | 1.5.4 (2026-09-07 19:52) | 1.5.3 (2025-08-13 09:26) | 1.5.2 (2025-04-27 12:16) | 1.5.1 (2024-12-16 15:00) | 1.5.0 (2024-12-15 10:53) | 1.4.0 (2023-12-06 17:13) | 1.3.2 (2023-08-06 08:20) | 1.3.1 (2023-05-20 07:59) | 1.3.0 (2023-04-03 19:26) | 1.2.3 (2023-03-24 13:58) | 1.2.2 (2023-01-10 14:43) | 1.2.1 (2022-11-09 12:19) | 1.2.0 (2022-10-30 07:10) | 1.1.8 (2022-10-25 15:18) | 1.1.7 (2022-10-23 14:44) |
A better, faster and stronger spiritual successor to bzip2. It compresses better and runs faster thanks to an order-0 context mixing entropy coder, a fast Burrows-Wheeler transform built on suffix arrays, and a Lempel-Ziv prediction pass based on LZ77-style string matching and PPM-style context modeling.
bzip3 is licensed under the GNU Lesser GPL version 3 or later. See COPYING and AUTHORS. Report issues at <https://github.com/iczelia/bzip3>.
bzip3 file # writes file.bz3
bzip3 -d file.bz3 # restores file
bzip3 -B -j 4 *.txt # process every file, four blocks at a time
tar c dir | bzip3 -b 64 > dir.tar.bz3
bz3cat dir.tar.bz3 | tar xEncoding is the default setting. -d decompresses and -t checks a file. With one file name, the output name is derived by adding or removing .bz3; a second name is the output, and -c writes to the standard output. -B treats every name as an input. Existing files are kept unless -f is given, and --rm removes the inputs once they were processed.
-b sets the block size in MiB, from 1 to 511; the default is 16. Larger blocks compress better and need about six times their size in memory, to compress and to decompress. -j codes that many blocks at once.
The bunzip3, bz3cat, bz3less, bz3more, bz3most and bz3grep scripts work like their bzip2 namesakes. See bzip3(1).
Use your package manager or download a release from GitHub Releases.
To build a release tarball, run
./configure
make
make check
sudo make installThe project uses C99 and, for -j, POSIX or Windows threads. libsais is bundled unmodified in 3rdparty/libsais.
| Configure option | Effect |
|---|---|
--enable-sanitizers | Enable ASan and UBSan for tests |
--disable-simd | Build the portable CRC-32C only |
--disable-threads | Code the blocks of -j and bz3_encode_blocks one at a time |
--enable-static-exe | Link bzip3 statically |
--disable-shared, --disable-static | Choose the kinds of libbzip3 to build |
Run ./bootstrap first when building from a Git checkout. It requires autoconf, automake and libtool. The version comes from git describe, so a checkout needs its tags.
The build is portable by default: pass CFLAGS="-O2 -march=native" to configure to tune it for the machine it is built on.
libbzip3 and its header libbz3.h are installed with the tool, with a pkg-config file:
cc example.c $(pkg-config --cflags --libs bzip3)bz3_compress and bz3_decompress code a buffer in one call; bz3_encode_block and bz3_decode_block code single blocks and are what the tool is built on. include/libbz3.h documents them and examples/hl-api.c uses them. The format is described in doc/bzip3_format.md.
Every release reads the files of the releases before it. The shared library exports only the functions of libbz3.h, and the static library defines no symbol outside of the bz3_ namespace.
Files are portable across hosts and byte orders. The checksum is CRC-32C; on x86 and 64-bit ARM a kernel using the CPU's CRC instructions is built next to the portable one and chosen at run time when the CPU has them.
Windows builds use MinGW as follows:
./configure --host=x86_64-w64-mingw32 CC=x86_64-w64-mingw32-gcc --enable-static-exe
makemake check runs unit tests of the coders, tests of the library interface and of the command line tool, and decodes reference files written by bzip3 1.5.5. make check-full and make check-torture code more data.
fuzz/build.sh builds libFuzzer harnesses for the block decoder, the frame decoder and the round trip with ASan and UBSan; FZ_SAN=msan and FZ_SAN=standalone select MemorySanitizer or a plain tool that replays inputs.
