1 unstable release
| 0.1.0 | Oct 29, 2025 |
|---|
#638 in Cryptography
15KB
275 lines
hashsum
CLI to print or verify cryptographic checksums (md5, sha1, sha2 family, belt-hash).
Install
From local path:
cargo install --path /path/to/repository
From Git repository:
cargo install --git <git-url> hashsum
From crates.io (after publishing):
cargo install hashsum
Usage
hashsum [OPTIONS] [FILE]...
- When no
FILEis given, or when-is used, input is read from stdin. - Default algorithm is
md5.
Options
-a, --algorithm <ALG>: Hash algorithm (md5,sha1,sha224,sha256,sha384,sha512,belt-hash)-c, --check: Read checksums from the given files and verify them--ignore-missing(with--check): Do not fail on missing files-q, --quiet(with--check): Do not printOKfor each successfully verified file--status(with--check): Do not print anything; use exit status only--strict(with--check): Treat malformed lines as fatal errors-w, --warn(with--check): Warn about malformed lines
Algorithms
- md5
- sha1
- sha224, sha256, sha384, sha512
- belt-hash
Output format
When computing hashes:
<hex-digest> <filename>
When verifying with --check, the input format supported is compatible with common tools:
<hex-digest> <filename>
<hex-digest> *<filename>
On success (unless --quiet or --status):
<filename>: OK
On mismatch:
<filename>: FAILED
Examples
Compute SHA-256 of a file:
hashsum -a sha256 path/to/file
Verify checksums listed in checksums.txt:
hashsum --check checksums.txt
Read from stdin:
cat file | hashsum -a sha1 -
Exit codes
0: success (all requested operations succeeded)1: at least one file failed, IO error, or malformed line in strict mode
Dependencies
~1.7–2.5MB
~50K SLoC