Skip to content

Instantly share code, notes, and snippets.

@intrd
Created March 19, 2018 11:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save intrd/f95053a409b1a9f5ad3d1fe0881773f8 to your computer and use it in GitHub Desktop.
Save intrd/f95053a409b1a9f5ad3d1fe0881773f8 to your computer and use it in GitHub Desktop.
One-liner password leak check + k-anonymity method (w/out exposing the password on request)
## One-liner password leak check + k-anonymity method (w/out exposing the password on request)
# Compute the SHA1, Grab 1st 5 chars of the hash, check by range on huge haveibeenpwnd DB!
# original source: https://news.ycombinator.com/item?id=16432344
VARPWD='test123'; HASH=`echo -n $VARPWD | sha1sum`; curl --silent https://api.pwnedpasswords.com/range/`cut -b 1-5 <(echo $HASH)` --stderr - | grep -i `cut -b 6- <(echo $HASH) | cut -d ' ' -f 1`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment