Last active
December 15, 2020 17:18
-
-
Save jac18281828/344ece5848a5282a176ebbd4f47c5019 to your computer and use it in GitHub Desktop.
openssl based sha256 checksum utility works on macOS
This file contains hidden or 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
#!/usr/bin/env /bin/bash | |
# SHA 256 based on openssl | |
# | |
# sha256 similar to the classic "md5sum" command line | |
# | |
if [[ ${#} -gt 0 ]] | |
then | |
# iterate over all arguments | |
while [[ ${#} -gt 0 ]] | |
do | |
if [[ -f $1 ]] | |
then | |
openssl dgst -sha256 "$1" | awk '{print $NF}' - | |
else | |
echo "$1 does not exist." | |
fi | |
shift | |
done | |
else | |
echo $0 files... | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment