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).
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|:---|---:|---:|---:|---:|
| paq ./go
| 127.8 ± 7.3 | 112.0 | 137.0 | 1.00 |
| find ./go -type f -print0 \| sort -z \| xargs -0 b3sum \| b3sum
| 172.8 ± 11.3 | 156.3 | 193.8 | 1.35 ± 0.12 |
| find ./go -type f -print0 \| sort -z \| xargs -0 sha256sum \| sha256sum
| 1610.7 ± 25.3 | 1571.4 | 1649.8 | 12.60 ± 0.74 |
Benchmarked using hyperfine.
Installation requires cargo.
cargo install --path .
from repository root..zip
archive for computer Operating System and Architecture..zip
.paq
binary to allow execution.paq
to 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.
For help, run paq --help
.
bash
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
.
```rust use paq;
let source = std::path::PathBuf::from("/path/to/source"); let ignorehidden = true; // .dir or .file let sourcehash: paq::ArrayString<64> = paq::hashsource(&source, ignorehidden);
println!("{}", source_hash); ```
```rust use paq;
let source = std::path::PathBuf::from("example"); let ignorehidden = true; let sourcehash: paq::ArrayString<64> = paq::hashsource(&source, ignorehidden);
asserteq!(&sourcehash[..], "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.