Hash file or directory recursively.
Powered by blake3 cryptographic hashing algorithm.
The Go programming language repository was used as a test data source (157 MB / 14,490 files).
| Tool | Version | Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|---|---|
| paq | latest | paq ./go | 99.5 ± 0.7 | 98.6 | 101.6 | 1.00 |
| b3sum | 1.5.1 | find ./go ... b3sum | 314.3 ± 3.9 | 308.9 | 320.8 | 3.16 ± 0.04 |
| dirhash | 0.5.0 | dirhash -a sha256 ./go | 565.1 ± 5.8 | 558.7 | 572.3 | 5.68 ± 0.07 |
| GNU sha2 | 9.7 | find ./go ... sha256sum | 752.0 ± 60.7 | 683.2 | 817.1 | 7.56 ± 0.61 |
See benchmarks documentation for more details.
Windows, macOS, and Ubuntu are supported.
- Download: Go to the Latest Release page and download the
.ziparchive matching your OS and Architecture. - Extract: Unzip the
.ziparchive to retrieve thepaqbinary. - Install: Make the
paqbinary executable (e.g.,chmod +x) and move it to a directory in your system PATH. - Verify: Confirm installation by running
paq --versionfrom the Command Line Interface.
Requires the cargo package manager.
cargo install paqNot recommended due to instability of main branch in-between tagged releases.
- Clone this repository.
- Run
cargo install --path .from repository root.
Requires nix and the nix-command experimental feature to be enabled.
nix profile add github:gregl83/paqSupport for Python is available in the paqpy package.
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 ./examplePath 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:
- File modes
- File ownership
- File modification and access times
- File ACLs and extended attributes
- Hard links
- Symlink target contents (target path is hashed)
Additionally, files or directory contents starting with dot or full stop can optionally be ignored.
- Recursively get path(s) for a given source argument.
- Hash each path and file contents if path is to a file.
- Sort the list of hashes for consistent ordering.
- Compute the final hash by hashing the list of hashes.
