huff is a fast, lightweight, and fully standalone Huffman-based file compressor written in Rust.
It supports:
- ✔️ Compressing
.txtfiles into a custom.huffbinary format - ✔️ Decompressing
.hufffiles back to original text - ✔️ Optional parallel frequency counting with Rayon
- ✔️ Clean CLI interface using Clap
- ✔️ Extremely fast & memory-safe
This tool is ideal for learning compression algorithms, benchmarking performance, and experimenting with bit-level control.
- ⚡ High-performance Huffman coding
- 🧠 Custom binary format using bit-level encoding
- 🧵 Parallel processing support
- 🔧 Clean and readable CLI with help + flags
- 📦 Cross-platform (Linux, macOS, Windows)
src/
├── main.rs # CLI logic (Clap)
├── huffman.rs # Huffman encoding/decoding core
├── compression.rs # Reading text file -> .huff file logic
Cargo.toml
README.mdBuild:
cargo build --release
sudo cp target/release/huff /usr/local/bin/Build:
cargo build --release
copy target\release\huff.exe C:\Windows\System32\huff --helphuff compress -i input.txt -o output.huffhuff decompress -i output.huff -o recovered.txthuff compress -i quotes.txt -o quotes.huffhuff decompress -i quotes.huff -o quotes_restored.txt