1781373563
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
set -e # we do noot tolerate failure here
|
||||
|
||||
# aint got no time for no bs
|
||||
if [ -z "$1" ]; then
|
||||
echo -e "ERROR\nUsage: hash_cred_check.sh <email or phone number>"
|
||||
exit 1 # fail with error
|
||||
fi
|
||||
|
||||
# 256 bits of random shit, encoded as base64
|
||||
salt="$(openssl rand -base64 32)"
|
||||
|
||||
# set credential
|
||||
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: $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\""
|
||||
Reference in New Issue
Block a user