33 lines
782 B
Bash
33 lines
782 B
Bash
#!/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 |