| Crates.io | hashdir2 |
| lib.rs | hashdir2 |
| version | 0.1.2 |
| created_at | 2025-10-18 23:09:28.652319+00 |
| updated_at | 2025-10-18 23:14:13.043678+00 |
| description | A fast, parallel, multi-algorithm directory hasher. |
| homepage | |
| repository | https://github.com/JerryImMouse/hashdir2 |
| max_upload_size | |
| id | 1889730 |
| size | 50,202 |
A fast, parallel, multi-algorithm directory hashing library and CLI.
hashdir2 provides both a library and a command-line tool for hashing directories
recursively using multiple algorithms. It is designed to be efficient, deterministic,
and suitable for use in automated environments such as CI/CD pipelines.
[!IMPORTANT]
This library is very raw and there are could be some critical bugs not found yet. Keep that in mind when working with it.
Add to Cargo.toml:
[dependencies]
hashdir2 = "0.1"
To install the CLI binary:
cargo install hashdir2
After installation:
hashdir2 --help
use hashdir2::hash::blake3::Blake3Hasher;
use hashdir2::walk::{DirHasher, WalkEvent};
fn main() -> std::io::Result<()> {
let hasher = DirHasher::new(Blake3Hasher::new());
let root_hash = hasher.walk("./target", |event| {
if let WalkEvent::File { path, .. } = event {
println!("hashed: {}", path.display());
}
}, None)?;
println!("root hash: {:x?}", root_hash);
Ok(())
}
Hash a directory:
hashdir2 /path/to/dir
Select algorithm:
hashdir2 --algo blake3 /path/to/dir
Verify against a known hash:
hashdir2 --verify expected.txt /path/to/dir
Output in base64:
hashdir2 --format base64 /path/to/dir
| Feature | Description |
|---|---|
default |
Enables the cli feature |
cli |
Enables the command-line interface and dependencies (clap, indicatif, hex, base64) |
Example disabling the CLI:
[dependencies]
hashdir2 = { version = "0.1", default-features = false }
Licensed under MIT license (LICENSE)