summaryrefslogtreecommitdiff
path: root/misc/verify
diff options
context:
space:
mode:
authorTimmy Keller <tjk@tjkeller.xyz>2022-03-16 23:37:09 -0500
committerTimmy Keller <tjk@tjkeller.xyz>2022-03-16 23:37:09 -0500
commit3d3d79a57fb6d0a5728e0070475f05d1699f0818 (patch)
treeb141cba678d6bb9821bb33b0dd7c7f1ca31b2c6a /misc/verify
parentd51fa1bdda79b8589ddf0002fc4b54aac6ce8354 (diff)
downloadscripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.tar.xz
scripts-3d3d79a57fb6d0a5728e0070475f05d1699f0818.zip
move a lot of scripts around and make a bunch of minor changes. once again i am too lazy to document the changes properly since im never going to read these commit messages anyways
Diffstat (limited to 'misc/verify')
-rwxr-xr-xmisc/verify16
1 files changed, 9 insertions, 7 deletions
diff --git a/misc/verify b/misc/verify
index 0d17085..5f0430c 100755
--- a/misc/verify
+++ b/misc/verify
@@ -3,19 +3,21 @@ NORM="\033[0m"
CYN="\033[0;36m"
GRN="\033[0;32m"
RED="\033[0;31m"
+
printhelp() {
-echo "\
+cat << HELPDOC
Usage: $(basename "$0") [options] [file/directory]...
OPTIONS:
-m, --md5 Create/verify md5 checksum
- -s[alg], --sha[alg] Create/verify sha checksum
- -x[alg], --xxh[alg] Create/verify xxh checksum
- -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum)
+ -s[mode], --sha[mode] Create/verify sha[mode] checksum
+ -x[mode], --xxh[mode] Create/verify xxh[mode] checksum (default)
+ -c [alg], --crypt [alg] Create/verify [alg] checksum (uses [alg]sum program; e.g. '-c sha256' uses sha256sum)
-v, --verify Verify files with existing checksums
- -h, --help Print help \
-";
+ -h, --help Print help
+HELPDOC
}
+
crypt=xxh
while true; do
case "$1" in
@@ -30,7 +32,7 @@ while true; do
esac
shift
done
-hashalg=${crypt}sum # Works for current algs
+hashalg=${crypt}sum
command -v $hashalg >/dev/null || (echo "Hashing algorithm '$hashalg' does not exist!" && exit 2)
while [ -n "$1" ]; do