1781373563
This commit is contained in:
@@ -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"
|
||||
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\""
|
||||
@@ -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 '<email or phone number>' '<salt>' '<hash>'"
|
||||
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
|
||||
Reference in New Issue
Block a user