diff --git a/customscripts/hash_cred_check.sh b/customscripts/hash_cred_create.sh similarity index 65% rename from customscripts/hash_cred_check.sh rename to customscripts/hash_cred_create.sh index 00f63ef..7a1c6a8 100644 --- a/customscripts/hash_cred_check.sh +++ b/customscripts/hash_cred_create.sh @@ -16,5 +16,9 @@ credential="$1" # output hex bytes after doi one hell of a argon2id fuckery hash=$(echo -n "$credential" | argon2 "$(base64 -d <<< $salt)" -id -t 8 -m 19 -p 2 -r) -echo "$hash" -echo "$salt" \ No newline at end of file +echo "Hash: $hash" +echo "Salt: $salt" +echo "Credential: $credential" +echo 'Protocol: echo -n "$credential" | argon2 "$(base64 -d <<< $salt)" -id -t 8 -m 19 -p 2 -r' +echo +echo "Verify with: bash hash_cred_verify.sh \"$credential\" \"$salt\" \"$hash\"" \ No newline at end of file diff --git a/customscripts/hash_cred_verify.sh b/customscripts/hash_cred_verify.sh new file mode 100644 index 0000000..aeebd23 --- /dev/null +++ b/customscripts/hash_cred_verify.sh @@ -0,0 +1,33 @@ +#!/bin/bash +set -e # mama didnt raise no bitch + +# aint got no time for no bs +if [ -z "$1" -o -z "$2" -o -z "$3" ]; then + echo -e "ERROR\nUsage: hash_cred_check.sh '' '' ''" + exit 1 # fail with error +fi + +# set credential +credential="$1" +#set salt +salt="$2" +# set hash +hash="$3" + +# debug +## echo -e "credential $credential" +## echo -e "salt $salt" +## echo -e "hash $hash" + +# run da fuck +hash_check=$(echo -n "$credential" | argon2 "$(base64 -d <<< $salt)" -id -t 8 -m 19 -p 2 -r) + +# debug +## echo -e "hash check $hash_check" + +# compare demmm +if [[ $hash == $hash_check ]]; then + echo -e "\n\e[32mGOOD MATCH! \e[0m\n\t$credential \e[32mVERIFIED\e[0m\n" +else + echo -e "\n\e[31mBAD MATCH! \e[0m\n\t$credential \e[31mNOT VERIFIED\e[0m\n" +fi \ No newline at end of file