kiss: Fix sh256

This commit is contained in:
Dylan Araps 2020-11-26 16:30:02 +02:00
parent 3f65c8a725
commit 9f82ac1cd7
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

7
kiss
View File

@ -114,17 +114,14 @@ sh256() {
#
# Example: '<checksum> <file>'
# Skip non-files and broken symlinks.
if { [ -h "$1" ] && [ -e "$1" ]; } || [ -f "$1" ]; then
if [ ! -d "$1" ] && [ -e "$1" ]; then
hash=$(
sha256sum "$1" ||
sha256 -r "$1" ||
openssl dgst -sha256 -r "$1" ||
shasum -a 256 "$1" ||
digest -a sha256 "$1"
)
printf '%s\n' "${hash%% *}"
) 2>/dev/null
fi
}