Skip to content

Instantly share code, notes, and snippets.

@skanjo
Forked from jac18281828/sha256
Created September 19, 2018 17:50
Show Gist options
  • Save skanjo/87ce9eb3197187982df96c35b13212f9 to your computer and use it in GitHub Desktop.
Save skanjo/87ce9eb3197187982df96c35b13212f9 to your computer and use it in GitHub Desktop.
sha256 command line utility
#!/usr/bin/env /bin/sh
# 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 sha -sha256 $1 | awk '{print $2}' -
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