When you create an account on the internet, you enter your username and password into a form, click a submit button, and proceed from there.
But what did the account provider do with your password? Did they store it in plain text? Did they encrypt it before storing? Do they decrypt it whenever you sign in?
In this post, I will explain three principles that responsible account providers follow when storing passwords.
First, your password is scrambled into a sequence of bytes, called a hash, to protect it from prying eyes.
The hash cannot be unscrambled, so every time you supply a password to access your account, the hash of your supplied password is computed and compared to the hash of your original password.
Use the following widget to see what a hash of a password looks like.
The hash looks like a random string of characters and does not resemble the password.
True story. In 2019, Facebook discovered that the passwords for hundreds of millions of accounts were stored in plain text on internal systems and were accessible to employees. The passwords were not scrambled.
Next, your password is scrambled only after it is appended or prepended with a random sequence of bytes, called a salt, to prevent password attacks that involve scrambling potential passwords in advance.
Use the following widget to see what a hash of a password looks like with and without salt.
The second hash is less secure, because an attacker would be able to deduce the password by searching for the second hash among precomputed hashes of potential passwords.
The first hash is more secure, because the attacker would not know the salt in advance, and hence, would not be able to precompute the required hashes.
True story. In 2016, LinkedIn reported that the passwords for more than 100 million accounts, stolen from a data breach in 2012, had been put up for sale on the internet. The passwords were not salted.
Finally, your password is scrambled using an intentionally slow algorithm to mitigate password attacks that involve scrambling potential passwords by trial‑and‑error.
Use the following widget to see how long it takes to compute a hash of a password under different speed settings.
The third hash is the most secure of the three hashes, because given the same list of potential passwords, an attacker would spend the most time computing hashes of incorrect passwords before arriving at the third hash.
Let me conclude this post with an application. Don't depend solely on your account provider to keep your password safe.
Don't depend solely on your account provider to keep your password safe.
In the event of a data breach, a slow and salted password hash cannot stop your password from being cracked. It can only delay the crack.
But the good news is you can influence the length of that delay.
If your password is short and predictable, the delay might span a couple of seconds or minutes at most.
But if your password is long and random, which is possible with the help of a password manager, the delay might extend to a point where the attack is not deemed to be worthwhile.