4 releases (2 breaking)
0.4.0 | Jul 2, 2022 |
---|---|
0.3.0 | Jun 28, 2021 |
0.2.1 | Jun 5, 2021 |
0.2.0 | Jun 4, 2021 |
#1882 in Cryptography
26KB
430 lines
Digestify
digest·i·fy -| _ˈdī-ˌjest-ə-ˌfī
noun - A command line tool to make verification of digests/checksums/hashes on downloaded files a little easier. Just specity the file and the hash listed on the download host. It will infer the possible digest algorithm(s) from the length. It's process exit code will be indicate whether the digest matches.
verb - Portmanteau of digest and verify. Compute a digest of a file and verify that the digest matches a provided value.
Supported Digests
Algorithm |
Bit Length |
Hexadecimal Length |
---|---|---|
SHA-512 | 512 | 128 |
SHA-256 | 256 | 64 |
SHA-1 | 160 | 40 |
MD5 | 128 | 32 |
CRC-32 | 32 | 8 |
Usage
$ digestify -h
digestify 0.4.0
Verify a file against a provided digest/hash/checksum.
USAGE:
digestify <file> <digest>
ARGS:
<file> File to verify
<digest> Digest to compare to, specified as a case-insensitive hexadecimal string
OPTIONS:
-h, --help Print help information
-V, --version Print version information
If a match is found against one of the digest algorithms, the command will succeed. Otherwise, it will fail.
Example Usages
# digestify Cargo.lock 19189c1219285b61ce1e95f9e4fdd5354a926075db9cf5dc62cf1801702c67d2
Verifying 'Cargo.lock' against provided digest of size 64 hex chars / 256 bits. Candidate digest(s): SHA-256.
SHA-256: PASS
Expected=19189c1219285b61ce1e95f9e4fdd5354a926075db9cf5dc62cf1801702c67d2
Actual=19189c1219285b61ce1e95f9e4fdd5354a926075db9cf5dc62cf1801702c67d2
PASS: Provided digest matches the content.
# echo $?
0
# digestify Cargo.toml f26c2e4e001349b737a3a5cc5fc4afc87b423773
Verifying 'Cargo.toml' against provided digest of size 40 hex chars / 160 bits. Candidate digest(s): SHA-1.
SHA-1: FAIL
Expected=f26c2e4e001349b737a3a5cc5fc4afc87b423773
Actual=95ee03e733a0111ac9d6b2073f4acec0f120fae5
FAIL: Provided digest doesn't match any of the candidate digest results.
# echo $?
2
Dependencies
~4MB
~75K SLoC