Skip to content

Instantly share code, notes, and snippets.

@elementalvoid
Created September 30, 2018 19:31
Show Gist options
  • Save elementalvoid/b316bb4fa9d801f1ab6b3d3bf380ee30 to your computer and use it in GitHub Desktop.
Save elementalvoid/b316bb4fa9d801f1ab6b3d3bf380ee30 to your computer and use it in GitHub Desktop.
p0wned? zsh shell func to check against api.pwnedpasswords.com for your password.
# Uses the range check to avoid sending your actual password and then checks the returned list locally.
p0wned () {
read -s 'pass?Enter password: '
echo
sum=$(echo -n "$pass" | sha1sum | cut -c1-40)
short=$(echo -n $sum | cut -c1-5)
remain=$(echo -n $sum | cut -c6-40)
curl -s https://api.pwnedpasswords.com/range/${short} | grep -i ${remain}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment