Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1hash("cat123") → 8f3a91c2 | Ahash("cat123") == hash("cat123") | |
| 2hash(attempt) == stored_hash | Bunhash("8f3a91c2") → impossible | |
| 3The same input always gives the same hash, so a correct password matches the stored hash | CThe password is turned into a scrambled value that gets stored instead of the real password | |
| 4A hash can't be reversed, so a thief with the database can't simply read the passwords | DThe typed password is compared directly with the hash. The attempt must be hashed first, so they will never match. | |
| 5stored_password = "cat123" | EThe real password is saved in plain text. If the database is stolen, the thief can read every password straight away. | |
| 6if attempt == stored_hash: | FThe login check: hash what the user typed and compare it with the saved hash |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
hash — A one-way scrambled value made from a password. A system stores it instead of the real password and checks a login by hashing what you type and comparing. It can't be reversed.stored ← hash(password)stored ← hash(password)
IF hash(attempt) = stored THEN
OUTPUT "Login ok"h1 ← hash("sunny")
h2 ← hash("sunny")
IF h1 = h2 THEN OUTPUT "Same"INPUT password
SAVE hash(password) TO databaseINPUT password
stored ← hash(password)