COOLJAPAN
← All posts

OxiArc 0.2.2 Released — A From-Scratch Zstandard Encoder Lands, and OxiArc Can Finally WRITE Zstd

OxiArc 0.2.2 ships a complete Zstandard encoder built from scratch — FSE, canonical Huffman, and an LZ77 match finder with 22 levels — so the workspace now writes real .zst, not just reads it. Plus an n-gram Zstd dictionary trainer, LZ4 dictionary frames, and richer ZIP64 with AES-256 and ZipCrypto. Pure Rust archive and compression, no C, no zlib, no libzstd.

release oxiarc compression zstd lz4 zip archive pure-rust data-processing scirs2

The COOLJAPAN compression layer just learned to write Zstandard from the ground up.

Today we released OxiArc 0.2.2 — pure Rust archive and compression, now with a complete, from-scratch Zstandard encoder so the workspace can write real .zst, not just read it.

No C. No Fortran. No zlib. No libzstd. No libzip. No libarchive. No 7-zip. No external shared libraries.
No FFI overhead. No build hell.
Just clean, memory-safe, blazing-fast archiving and compression that compiles to a single static binary (or WASM) and runs everywhere.

Why OxiArc 0.2.2 matters

Handling archives and compression has long meant leaning on heavy native libraries — zlib, libzstd, libzip, libarchive, 7-zip — with all the baggage that brings:

Zstandard is the modern default for fast, high-ratio compression — but until now a pure-Rust pipeline could read Zstd while still reaching for libzstd (or the zstd crate’s C bindings) the moment it needed to produce a .zst. 0.2.2 closes that gap. oxiarc-zstd now contains a real entropy-coding encoder — Finite State Entropy tables, canonical Huffman for literals, and an LZ77 match finder — assembled into valid Zstd compressed blocks. The write path is sovereign too.

Technical Deep Dive: A Zstandard Encoder, Built From Entropy Coding Up

OxiArc keeps its layered shape — a core layer, codec crates, a container layer, and a CLI — and 0.2.2 lands almost entirely in the Codec Layer and Container Layer.

  1. Core Layer (oxiarc-core) Shared Compressor/Decompressor traits, CRC-32/64/16 with slicing-by-8, and bitstream utilities — unchanged and carried forward.

  2. Codec Layeroxiarc-zstd gains a full encoder, written as a stack of new modules:

    • bitwriter — a ForwardBitWriter (LSB-first) for FSE table headers, and a sentinel-marked BackwardBitWriter that emits the reversed bitstream FSE sequence encoding needs.
    • lz77 — a hash-chain MatchFinder with multiply-shift hashing, 22 compression levels, MIN_MATCH = 3 / MAX_MATCH = 65539, and a public Lz77Sequence / LevelConfig / MatchFinder surface.
    • huffman_encoder — canonical Huffman for literals with Kraft-inequality length limiting to MAX_CODE_LENGTH = 11, plus weight-table serialization.
    • fse_encoder — Finite State Entropy tables and state machine, with ll_code / ml_code / of_code helpers and the predefined LL/OF/ML tables.
    • compressed_block — assembles full Zstd compressed blocks from LZ77 sequences.
    • A public streaming module (ZstdStreamEncoder<W: Write> with finish(), and ZstdStreamDecoder<R: Read>), and a public dict module (ZstdDict, an n-gram train_dictionary(samples, dict_size) trainer, MAX_DICT_SIZE = 1 MB). The new ZstdEncoder exposes compress_with_level / encode_all / decode_all, plus a feature-gated compress_parallel (Rayon, behind the parallel feature). Levels 0–22.
    • oxiarc-lz4 also picks up dictionary frame support: Lz4DictFrameEncoder / Lz4DictFrameDecoder, compress_frame_with_dict / decompress_frame_with_dict (the dict ID is stored and verified in the frame header), and FrameDescriptor::with_dict_id. The monolithic frame module was refactored into types / compress / decompress / streaming / frame_dict submodules with no public API breakage.
  3. Container Layer (oxiarc-archive) The ZIP header module split into types / reader / writer, with richer ZIP64: a DataDescriptor, and automatic ZIP64 upgrade of local headers, the central directory, and the EOCD when sizes or offsets exceed 0xFFFFFFFF (extra field 0x0001). Encryption read/write paths landed too — AES-256 (WinZip AE-2, HMAC-SHA1 tag verification) and ZipCrypto — via extract_with_password, extract_with_password_aes, and add_encrypted_file.

  4. CLI Layer (oxiarc-cli) The unified oxiarc binary, carried forward — and now able to produce Zstd-compressed archives end to end.

Getting Started

0.2.2 is on crates.io. To write real Zstd as a library, add the codec:

cargo add oxiarc-zstd
use oxiarc_zstd::{ZstdStreamEncoder, encode_all, decode_all};
use std::io::Write;

// Streaming: write a .zst as you go, then finish().
let mut out = Vec::new();
let mut enc = ZstdStreamEncoder::new(&mut out, 19)?;   // level 0-22
enc.write_all(b"Hello, Zstandard, written in pure Rust!")?;
enc.finish()?;

// Or one-shot:
let compressed = encode_all(b"some bytes", 19)?;
let original = decode_all(&compressed)?;

Prefer the CLI? You can now create a Zstd-compressed tarball directly:

oxiarc create backup.tar.zst folder/

What’s New in 0.2.2

Quality this release: zero Clippy warnings (-D warnings), zero rustdoc warnings, and a 100% test pass.

Tips

Getting the most out of the new write path:

This is the foundation

OxiArc is the compression and archival backend other COOLJAPAN projects build on. It still depends on no sibling projects — just small, focused Rust crates — so siblings sit on top of it, not beside it.

With a real Zstd write path in hand, OxiMedia gains a sovereign way to package media assets, and SciRS2, NumRS2, and PandRS get pure-Rust .zst output for dataset and long-term storage — the same fast, high-ratio format the rest of the world uses, now without the C dependency underneath. It is the quiet data-packaging layer beneath the COOLJAPAN scientific and media stack.

Repository: https://github.com/cool-japan/oxiarc

Star the repo if you want high-performance archiving and compression without the traditional native toolchain headaches.

Pure Rust archiving and compression is here — fast, safe, and sovereign.

KitaSan at COOLJAPAN OÜ March 10, 2026

↑ Back to all posts