13 lines
522 B
Bash
13 lines
522 B
Bash
raw_password='it was always you who i despised, redd fPGuXrWrP9WBWbW1xhSTwgBD :3'
|
|
full_hash=$(echo -n "$raw_password" | openssl dgst -sha1 | awk '{print toupper($2)}')
|
|
prefix="${full_hash:0:5}"
|
|
suffix="${full_hash:5}"
|
|
api_url="https://api.pwnedpasswords.com/range/$prefix"
|
|
if ! response=$(curl -s -H "User-Agent: Bash-Passphrase-Audit-Script" "$api_url"); then
|
|
echo "[FATAL] Failed to communicate with HIBP API." >&2
|
|
exit 3
|
|
fi
|
|
|
|
# echo -e "$response"
|
|
match=$(echo "$response" | grep -q -i "^$suffix:")
|
|
echo "$match" |