Skip to content

Instantly share code, notes, and snippets.

@jac18281828
Last active December 15, 2020 17:18
Show Gist options
  • Save jac18281828/344ece5848a5282a176ebbd4f47c5019 to your computer and use it in GitHub Desktop.
Save jac18281828/344ece5848a5282a176ebbd4f47c5019 to your computer and use it in GitHub Desktop.
openssl based sha256 checksum utility works on macOS
#!/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