Checking a password against Troy Hunt’s list
Tags: security, passwords, tips
Published: 2021-09-08 21:36:37

---
title: Checking a password against Troy Hunt’s list
published: true
date: 2021-03-28 15:00:00 UTC
tags: security,passwords,tips
canonical_url: https://katiekodes.com/have-i-been-pwned/
---

Troy Hunt, of [HaveIBeenPwned.com, a site that helps you learn what data breaches your email address was involved in](https://haveibeenpwned.com/), also keeps a [database of hacked passwords at api.PwnedPasswords.com](https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/) so you can check if your password's as bad as `password123` without actually typing your password anywhere on the internet.  I can't remember where I found my instructions for using it anymore, so I'm writing it down myself for future reference, and I apologize to whoever I'm not crediting.  I dusted these off recently to make a case to a family member for changing certain passwords I don't approve of _(tip:  just get your passwords from [Gibson Research Corporation's random high-entropy password generator](https://www.grc.com/passwords.htm))_.

1.	Compute the SHA-1 hash for the password in question.  From Windows, you can do this in the **Git Bash** shell you've likely installed on your computer if you're a programmer -- or on any other Unix-like command prompt.  _(I have yet to find a short-and-sweet command in Windows PowerShell.)_  Here are 3 examples using passwords of `password`, `monkey123`, and `xyzzy`.
    * `echo -n 'password' | sha1sum | awk '{print toupper($1)}'`<br/>_(result:  `5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8`)_
    * `echo -n 'monkey123' | sha1sum | awk '{print toupper($1)}'`<br/>_(result:  `721D65122734734800A1EDD6E68C03210E7B2ACA`)_
    * `echo -n 'xyzzy' | sha1sum | awk '{print toupper($1)}'`<br/>_(result: `AB69DB8315AF7DE6E673A6DDF128D415157A7C3F`)_
2.	In a web browser, pull up the URL `https://api.pwnedpasswords.com/range/FIRST_FIVE_OF_HASH_HERE`.  So, for example:
    * [https://api.pwnedpasswords.com/range/5BAA6](https://api.pwnedpasswords.com/range/5BAA6)
    * [https://api.pwnedpasswords.com/range/721D6](https://api.pwnedpasswords.com/range/721D6)
    * [https://api.pwnedpasswords.com/range/AB69D](https://api.pwnedpasswords.com/range/AB69D)
3.	In the resulting page, in your web browser, pick about 5-7 characters from anywhere in the rest of the SHA-1 hash.  For example, `EE68FD8` from the hash for `password` _(its last 7 characters)_.  Hit **Ctrl+F** to pull up the "find in page" functionality in your web browser and type those characters.  Make sure the result that the cursor jumped you to matches the "remainder" (after the first 5 characters) of the hash in its entirety; if not, search again or add more characters for a more precise search.
4.	See how bad things are:
    * If you don't find your hash "remainder" in the page, you made a typo … or it's never appeared in a hacked passwords dump – lucky you.
    * If you do find it, read the number of times it's been found in hacked-password dumps to get an idea of how likely it is to be vulnerable to a brute-force attack where common passwords are part of the "dictionary" of things to try.
5.	Clear out your **Git Bash** history so the password you were curious about isn't in plaintext on your computer in its history by typing the following 2 commands _(note:  I had to do this a few times, opening & closing Git Bash & hitting my "up" key to double-check, before I was fully satisfied that I had nothing but `exit` in my history)_:
    * `cat /dev/null > ~/.bash_history`
    * `history -c`