Skip to content

Instantly share code, notes, and snippets.

@pfgithub
Created August 10, 2020 10:40
Show Gist options
  • Select an option

  • Save pfgithub/a099442f6d3cf3613f4b05de9aae609b to your computer and use it in GitHub Desktop.

Select an option

Save pfgithub/a099442f6d3cf3613f4b05de9aae609b to your computer and use it in GitHub Desktop.
check if a password has been pwned on haveibeenpwned
#!/usr/bin/env fish
set password (read -s)
set sha1hash (echo -n $password | sha1sum)
set firstfiv (string sub -s 1 -l 5 $sha1hash)
set lastpart (string sub -s 6 -l 35 $sha1hash)
curl -s https://api.pwnedpasswords.com/range/$firstfiv | grep -i "^"$lastpart":"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment