hash-hunter
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.
Features
- 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.
Installation
Install from crates.io:
Usage
Search a directory for a SHA-256 hash (default):
Provide a file name to shortcut hashing when possible:
Use a different algorithm:
Batch mode (one target per line):
# batch.txt
<hash1> report.pdf
<hash2>
Write results to a text file:
Output
Results 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.
Library usage
The core logic is available as a library via hash_hunter::search for
applications that need to embed the search behavior directly.
Notes
- Hash inputs must be hexadecimal without a leading prefix.
- File name filtering is an optimization and does not replace hash validation.