Last active
May 5, 2024 01:44
-
-
Save CognitiveDisson/b7f773416c37b86248b7f498adf36bee to your computer and use it in GitHub Desktop.
One line to check pwned password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Execute fc -p for the zsh shell if you want to remove it from the history. | |
# In this method, you don't pass the actual password value. | |
# Instead, you only send the first five characters of its SHA1 hash | |
# and then grep for the second part of the checksum locally within the response. | |
echo -n '<your_password>' | \ | |
openssl dgst -sha1 -hex | \ | |
awk '{print $2}' | \ | |
tr a-z A-Z | \ | |
xargs -I % sh -c 'curl -s "https://api.pwnedpasswords.com/range/$(echo % | cut -c -5)" | grep "$(echo % | cut -c 6-)"' | \ | |
cut -d ":" -f2 | \ | |
awk '{print "pwned: " $0}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment