Lesson map
Lesson 08. Map, example, EX054.
flowchart TD
A["Two synthetic accounts, one password"] --> B["same stored value? False"]
B --> C["Right checks True, wrong check False"]
C --> D["Do not copy the laboratory secrets into notes"]
A shared password in the script is not a shared stored value, and it is not a library secret to write down.
Logical drawing
stored-value line stays False
right-password lines stay True and True
wrong-password line stays False
notes
no copy of those laboratory passwords
Learning outcomes
After this chapter, you should be able to:
- Keep all four salted-storage lines.
- Explain False on the "same stored value" line.
- Leave the laboratory passwords out of the library notes.
8.1 Four lines, none of them a member's secret.
lab_salted.py stores one synthetic password for two accounts and prints same password, same stored value? False. The next two lines say member 1 right password: True and member 2 right password: True. The last line says member 1 wrong password: False. A salt is a fresh random value per account, so equal passwords need not produce equal stored results, and the check repeats the calculation rather than looking up a saved password. A classmate who wants the first line to say True is erasing the salt. A classmate who pastes the script's passwords into the staff notes is breaking the sticky-note rule: record place and kind, not the secret itself. These four lines are a teaching run. They are not credentials Leo found at Willow Lane. He does not retune n, r, p, or the salt length.
8.2 Worked example
Lesson table; scroll horizontally to read all columns →
| What someone cites | What the file holds | Decision |
|---|---|---|
same stored value? False |
Different salts | Keep False |
| Both right-password lines | True and True | Keep both |
| The wrong-password line | False | Keep False |
| "Copy the script passwords into the notes." | Secrets stay out of notes | Refuse |
Synthetic case. The accounts in this run are not library members.
Errors and limits
Refusing to copy the passwords does not change the four printed Booleans.
Apply
- EX054 — Same value? Two synthetic accounts use the same password. The first printed line asks whether the stored values match. What does the file say, and may those passwords be copied into the library notes?
Show marking criteria
Rubric: 3 = the stored values differ, so the line stays False; both right-password lines stay True; the wrong-password line stays False; do not copy the laboratory passwords into the notes; do not editlab_salted.py;; 2 = False stays and the notes stay clear;; 1 = one line;; 0 = none.