Created
March 12, 2019 13:33
-
-
Save cjjuice/9d97dec383db852edf97050bc48ea51d to your computer and use it in GitHub Desktop.
Bash functions to print and check sha256 checksums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print_checksum() { | |
echo $1 | shasum -a 256 | |
} | |
verify_checksum() { | |
checksum=$(echo $1 | shasum -a 256) | |
if [[ $2 == "$checksum" ]]; then | |
echo "valid" | |
else | |
printf "invalid:\n$1 ($checksum)\nvs\n$2\n" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment