| Crates.io | paq |
| lib.rs | paq |
| version | 1.2.0 |
| created_at | 2021-12-17 20:47:49.447737+00 |
| updated_at | 2025-09-02 19:40:11.742339+00 |
| description | Hash file or directory recursively. |
| homepage | https://crates.io/crates/paq |
| repository | https://github.com/gregl83/paq |
| max_upload_size | |
| id | 499754 |
| size | 345,624 |
Hash file or directory recursively.
Powered by blake3 cryptographic hashing algorithm.
The go programming language repository was used as a test case (478 MB / 12,540 files).
| Tool | Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|---|
| paq | paq ./go |
116.4 ± 2.6 | 111.4 | 120.9 | 1.00 |
| b3sum | shell b3sum |
132.4 ± 1.5 | 129.6 | 135.9 | 1.14 ± 0.03 |
| dirhash | dirhash -a sha256 ./go |
642.5 ± 5.8 | 634.7 | 649.8 | 5.52 ± 0.13 |
| GNU sha2 | shell sha256sum |
1583.0 ± 16.3 | 1568.6 | 1606.8 | 13.60 ± 0.33 |
Performance benchmark uses hyperfine.
Commands with shell use the following command with various <hashsum> implementations:
find ./go -type f -print0 | LC_ALL=C sort -z | xargs -0 <hashsum> | <hashsum>
Installation requires cargo.
cargo install paq
Not recommended due to instability of main branch in-between releases.
cargo install --path . from repository root.Installation requires nix and the nix-command experimental feature to be enabled.
nix profile add github:gregl83/paq
.zip archive for computer Operating System and Architecture..zip.paq binary to allow execution.paq to a system path.Command Line Interface executable or Crate library.
Included in this repository is an example directory containing some sample files, a subdirectory and a symlink to test paq functionality.
Run paq [src] to hash source file or directory.
Output hash to .paq file as valid JSON.
For help, run paq --help.
paq ./example
Path to example directory can be relative or absolute.
Expect different results if -i or --ignore-hidden flag argument is used.
Add paq to project dependencies in Cargo.toml.
use paq;
let source = std::path::PathBuf::from("/path/to/source");
let ignore_hidden = true; // .dir or .file
let source_hash: paq::ArrayString<64> = paq::hash_source(&source, ignore_hidden);
println!("{}", source_hash);
use paq;
let source = std::path::PathBuf::from("example");
let ignore_hidden = true;
let source_hash: paq::ArrayString<64> = paq::hash_source(&source, ignore_hidden);
assert_eq!(&source_hash[..], "a593d18de8b696c153df9079c662346fafbb555cc4b2bbf5c7e6747e23a24d74");
Expect different results if ignore_hidden is set to false.
Hashes are generated using file system content as input data to the blake3 hashing algorithm.
By design, paq does NOT include file system metadata in hash input such as:
Additionally, files or directory contents starting with dot or full stop can optionally be ignored.