How does a website check your password without storing it?
A lesson on online safety. Computing, secondary school level.
A website checks your password by storing a hash of it instead of the password itself.
A hash is a scrambled code made by a maths recipe that is easy to run forwards but practically impossible to reverse.
When you sign up, the site adds a random extra string called a salt, hashes the result and saves only that code.
When you log in, it hashes what you typed in the same way and compares the two codes.
If they match, you typed the right password.
Changing even 1 letter of the password gives a completely different hash, so near guesses never match.
Questions in this lesson
- You forgot your password and click 'reset'. The site never emails you your old password, only a link to make a new one. Why do you think it does that?
- In your own words, how can a website tell you typed the right password when it never saved the password itself?