Good sites never store your password. They store a hash: a one-way scramble that is always the same for the same password, so a login can be checked but the hash can't be turned back. A stolen list can still be cracked by hashing common guesses, unless each person's password gets its own salt.
Websites get hacked and their password lists stolen. If the site did its job, the attackers still don't get your password. How?
What you should already know:
Challenge: the class server· Set up the Pi as a class server with a share, accounts, a firewall and a nightly backup.
Share files with Samba· Samba shares a folder so Windows, Mac and Linux computers can use it.
A hash protects passwords where they are stored. It turns any text into a fixed-length scramble. The same input always gives the same hash, but there is no way to work backwards from the hash to the input. (Protecting data while it travels is the next lesson.)
How this lesson works: Predict, Try, Investigate, Modify, Practise, Make
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
A stolen list
TryTry it on the board and compare the result with your prediction.
Try: sign in with a hash
Was your prediction right? Watch how many digits change for one letter.
Try it yourselfYour edits are saved in this browser.
The site stores only Kai's hash. Type Kai's password (maple). Then change one letter to a capital. What happens to the hash?
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: hashes and salt
Worked exampleBefore each step, say what you think comes next.
maple→49ead2b1066b…Hashing: a fixed-length scramble of the password.
sign in: hash(typed) = stored?The site compares hashes; it never needs the password.
Maple→a completely different hashOne small change changes everything, and it can't be reversed.
hash(guess) = stored?A thief can't reverse a hash, but can hash common passwords and look for a match.
salt+mapleEach person's salt makes the same password hash differently, so one guess no longer cracks everyone who picked it.
Now explain how a site checks a password.
Sam explains how Forgot password works. Click the line where it first goes wrong.
ModifyChange the problem on purpose and see what happens.
Students sign in against a stored hash, see one letter change the whole hash, crack an unsalted stolen list by hashing common guesses, then add a salt, and sort what a hash is for against what encryption is for (AC9TDI10K01 node 4, first half; Public and private keys is the second). About 45 minutes.
I can explain how sites check passwords without storing them.
I can explain what a salt adds.
I can say when a hash fits and when encryption does.
Before class
Try the boards yourself. The hash is real SHA-256 (shown short); the passwords in the lesson are practice ones. Tell students never to type a real password into any board.
The kit's typical width: hashing secures stored passwords; public key cryptography (next lesson) secures data in transit; they address different threats, and mixing them up is why this node is a hinge. Split from Hashes and keys on 25 Oct so each gets a full lesson. Simplifications: real sites use slow hashes built for passwords (bcrypt, Argon2) and store the salt beside the hash.
Links: Secret messages' key sharing (agreeing a key in public) is the other half of how HTTPS starts.
Running the lesson
Predict: students who chose "your password" assume sites keep it.
Try: count how many digits changed for one letter.
Worked example: ask why the same password must always give the same hash.
Vary: ask why the thief can crack Ana and Ben without reversing anything; then what the salt changes.
Make: remind students not to type a real password; it is a made-up passphrase.
The hard part (on purpose)
Hashing is one-way, which runs against intuition, and students call it encryption. Use the meat grinder (you can't un-mince) as the anchor, and the sort in Practise to pull hash and encryption apart.
When students get stuck
A student says the site turns the hash back (Sam's mistake). Ask: Why does the site send a reset link instead of your password? Fix: It can't reverse the hash.
A student calls hashing encryption. Ask: Could anyone, with any key, turn the hash back into maple? Fix: Encryption is undone with a key; a hash can't be undone at all.
Stretch and support
Stretch: Why do security experts recommend a password manager? What does it change about using the same password on several sites?
Support: Two cards: Only needs checking → hash (one way). Has to be read again → encryption (a key undoes it).
Where it leads
Next: Public and private keys (protecting data while it travels).
What each step is for
a stolen list: Committing to what a stolen password list contains tests the new move: sites store hashes, which can be checked but not reversed.
Try: sign in with a hash: Typing the password and seeing its hash match the stored one settles the prediction: the site checks hashes, never storing the password.
Worked example: hashes and salt: Following a sign-in through hashing, then two people with the same password, models the new move. Sam thinks a hash can be turned back, the misconception planted after the method.
Vary: crack a list, then salt it: Students see why a hash alone is not the end of the story: common passwords crack by guessing. Then the salt fixes the giveaway of two matching rows.
hashes: Spotting good and bad password storage, why guessing still works, hash or encryption (the hinge: the two get mixed up), and a review of access control.
a strong passphrase: Building a passphrase that meets a strength rule reverses the process: students start from what makes a hash hard to guess and make a password to match.