Outbound Link Summary:
10 years ago
p3k dots

Bash one-liner: Verify checksum of a downloaded file.

read -ep 'Enter path to file: ' file; read -ep 'Enter hash: ' hash; if [ `openssl sha1 -r $(eval echo "$file")  | sed -E "s/^(.*) .*$/\1/g"` == "$hash" ]; then echo 'Hash verified.'; else echo 'Hash not verified. Use file at your own risk.'; fi