hash-hunter is a Rust CLI and library for locating files by cryptographic hash. It supports common algorithms, optional name matching to avoid unnecessary hashing, and batch searches for multiple targets.
- Search directories for a target hash with optional file name filtering.
- Batch mode for multiple hashes and hash/name pairs.
- Multiple hashing algorithms (for example, SHA-256 and SHA3-256).
- Results can be streamed to stdout or written to a file.
- Library API for embedding search logic in other applications.
Install from crates.io:
cargo install hash-hunterSearch a directory for a SHA-256 hash (default):
hashhunter --dir ./data --hash <hex-hash>Provide a file name to shortcut hashing when possible:
hashhunter --dir ./data --hash <hex-hash> --name report.pdfUse a different algorithm:
hashhunter --dir ./data --algo sha3-256 --hash <hex-hash>Batch mode (one target per line):
# batch.txt
<hash1> report.pdf
<hash2>
hashhunter --dir ./data --algo sha256 --batch batch.txtWrite results to a text file:
hashhunter --dir ./data --hash <hex-hash> --output results.txtResults are written to stdout and optionally to --output. Matches are printed
as match: <path> (name) and missing targets are printed as
missing: <hash> (name). The summary includes total checked files plus any
unchecked files that failed to hash.
The core logic is available as a library via hash_hunter::search for
applications that need to embed the search behavior directly.
- Hash inputs must be hexadecimal without a leading prefix.
- File name filtering is an optimization and does not replace hash validation.