But not sure where to start? Find out if a tech career is right for you.


Password Hashing

Password hashing is a way a web site can store your password to keep it safe.

Password hashing is a way a web site can store your password to keep it safe.

Sooner or later a web site you’ve used is going to get hacked, their user data stolen, and your information exposed to the world. If your password is sitting there in plain sight – “password1234” – the hackers can combine it with your email address to try to log into bank accounts, Facebook, or anything else out there.

This is where password hashing comes in. The web site takes a password like password1234 and run it through a complex set of rules, which mixes it and mashes it into something like e6b6afbd6d76bb5d2041542d7d2e3fac5bb05593. This is called a hash.

You can think of a hash as your password’s fingerprint. Even if you change it a little bit, say to password1235, the hash ends up being super super different – 62f923cde8109b61a324f0677d7c0cafdb9e6480. Sites store this information instead of your actual password.

Checking password hashes is a lot like checking a criminal record. When the police bring you in for questioning, they don’t run you through a head-to-toe scanner and keep a copy of your body hanging around. They just take your fingerprints! If you show up again and they find your fingerprints in their system, they can be pretty sure that they know who you are.

It’s the same thing with password hashing. When a site asks you for your password – password123 – they store the hash in their database as e6b6afbd6d76bb5d2041542d7d2e3fac5bb05593. Then, next time you give them your password – password1234 – they hash it, get e6b6afbd6d76bb5d2041542d7d2e3fac5bb05593, and look it up in their database. If it matches, you’re in! If you gave them password1235 instead, the hash turns out to be 62f923cde8109b61a324f0677d7c0cafdb9e6480, and it’s a no go.

The best part about hashes is that they can’t be run backwards. In the same way that you can’t recreate an entire person from a fingerprint, you can’t recreate a password from a hash. That way when someone steals that database full of user information, you’ll be safe and sound!

Cocktail Party Fact

One weakness of hashing is that the same passwords are always the same hashes. Anytime a hacker comes across e6b6afbd6d76bb5d2041542d7d2e3fac5bb05593 they might know it’s password1234 if they’ve seen it before. Hackers have big big lists of common passwords and their hashes called rainbow tables.

Something called salting can keep you safe, though. When I first store your password, I plop a few random letters and numbers onto the end – password1234JNFD – and hash that. Every time I check your password in the future I add those little extra letters before I hash it, so even if you picked a common password, salting turns it into a new, uncommon word that hashes to a different value. You have password1234JNFD and I have passwordKJRF and we’re all safe.

The recent theft of LinkedIn’s user database is a good example of when salting comes in handy!

Your email address will not be published.



  1. You have small errors in the second-to-last paragraphs in both the “Cocktail Party Fact” section and the section before that.

  2. Jessie Kendall Replied

    How do I know if a website that I frequent actually uses hashing or salting to protect my passwords?

  3. Jess S Replied

    If you’re extra paranoid about salting passwords, like I am, I found a wonderful script to salt the heck out of someone’s password at http://createmy.com.au/php-password-salt-and-pepper-using-sha1-md5-hash/

    For every site I create, I change the modulus values for salt and sodium (when you divide by a number, then take the remainder, the number you divide *by* is the modulus), as well as the salt and sodium values.

    • Hey Jess, thanks so much for sharing this resource. Really awesome. And we love that ¬†you are looking out for the users on the site you make <3

Want more articles like this?

Sign up to get the most recent tech news, tips and career advice.