3 ms·
I love that simple API! Here's a bash one-liner that checks if 'hello' is compromised: curl -s https://api.pwnedpasswords.com/range/$(echo https://api.pwnedpas
by jakobegger 9y ago
I love that simple API! Here's a bash one-liner that checks if 'hello' is compromised:
curl -s https://api.pwnedpasswords.com/range/$(echo https://api.pwnedpasswords.com/range/$(echo -n hello | shasum | cut -b 1-5) | grep $(echo -n hello | shasum | cut -b 6-40 | tr /a-f/ /A-F/)
Edit: Improved one-liner that only requires typing the password once and avoids storing it in the bash history:
(echo -n "Password: "; read pw; curl -s https://api.pwnedpasswords.com/range/$(echo https://api.pwnedpasswords.com/range/$(echo -n $pw | shasum | cut -b 1-5) | grep $(echo -n $pw | shasum | cut -b 6-40 | tr /a-f/ /A-F/))
- espadrine 9y agoYou can use `read -s` to avoid risking having someone behind you read your password on your screen as you type it. (echo -n "Password: "; read -s pw; curl -s https://api.pwnedpasswords.com/range/$(echo https://api.pwnedpasswords.com/range/$(echo -n $pw | shasum | cut -b 1-5) | grep $(echo -n $pw | shasum | cut -b 6-40 | tr a-f A-F))