Study Guide Instructor view
Hashing and Integrity Checking
Teaching notes for Lesson 6.3, with controls for presenting it.
Keep this page on your own screen. Share only the lesson window. The lesson window holds no teaching notes, so sharing it cannot show them.
Presenting
- Open the lesson in its own window and share that window, not this one.
- Use Next and Previous here, or the lesson’s own, to move through the lesson. Next reveals one thing at a time: the next idea, or the answer to the question on screen, then the next step. Previous takes the last reveal back. The line below says what is on screen and what Next will show.
- Reveal hints and answers when the class is ready, and reset a demonstration before using it again.
The controls need JavaScript and a browser that supports BroadcastChannel. Without them, open the lesson in presentation mode and use its own controls.
The two windows talk to each other only inside this browser, on this device. Nothing is sent to a server, and no account is needed. A second device (a phone or another tablet) cannot follow the lesson window yet.
Now on the lesson window
- On screen
- Next teaching point
Guidance for this point
Lesson plan
- Level
- Beginner
- Time
- About 60 minutes; the steps below add up to 60
Learners start from a practical problem: checking that a 2 GB video arrived unchanged without sending it back. Over the phone they work out that both sides could compare a short code made from the file, and what that code must be like (any change must change it; no secret is needed). Only then is the hash function named. Predictions precede each point where intuition misleads: how much a one-character change alters the digest (before the panel, and before the properties are listed), whether a digest can be turned back into the video, what an attacker gains from two contracts with one digest, whether two inputs can ever share a digest, the birthday puzzle, and what a matching checksum proves.
Objectives
- Explain what a hash function does, and why a digest cannot be turned back into the data
- Tell hashing apart from encoding and encryption
- Explain preimage and collision resistance, and why every hash function has collisions
- Explain why MD5 and SHA-1 are unsuitable where collisions matter
- Check a download against a checksum, and say what a match does and does not prove
Before the lesson
- Open this page on your own screen and use “Open the lesson window” to open the lesson in a second window. Share only that second window.
- Try the digest panel beforehand: change one character and watch roughly half the digest change.
- Learners need the Cryptography Foundations lesson first: encryption and keys.
- The lesson takes about 60 minutes. To teach it in two parts, stop after “Collisions must exist”; the second part opens with “Why MD5 and SHA-1 are no longer suitable”.
- In presentation mode every step is shown in turns: Next reveals one moment, part or answer at a time, and the instructor view names what is on screen and what comes next.
Steps
Introduction Opening
On the lesson window now
On screen: the lesson’s title, module and number; Next adds its objectives and key terms, as the lesson page lists them; Next again begins the first step.
Objectives on screen
- Explain what a hash function does, and why a digest cannot be turned back into the data
- Tell hashing apart from encoding and encryption
- Explain preimage and collision resistance, and why every hash function has collisions
- Explain why MD5 and SHA-1 are unsuitable where collisions matter
- Check a download against a checksum, and say what a match does and does not prove
Purpose: Learners start from a practical problem: checking that a 2 GB video arrived unchanged without sending it back. Over the phone they work out that both sides could compare a short code made from the file, and what that code must be like (any change must change it; no secret is needed). Only then is the hash function named. Predictions precede each point where intuition misleads: how much a one-character change alters the digest (before the panel, and before the properties are listed), whether a digest can be turned back into the video, what an attacker gains from two contracts with one digest, whether two inputs can ever share a digest, the birthday puzzle, and what a matching checksum proves.
1. Is it the same file? Think 6 min
On the lesson window now
Purpose: Pose the integrity problem in a familiar setting and have learners work out what a short check code would need, before any term.
Ask
- What could you and your colleague compare on the phone that is much shorter than the file?
- Which property of that code matters most?
Responses to expect
- “File size” or “the first few lines” often come up. Ask whether a one-letter change would show.
- Some want the code to be secret. Ask who needs to make it, and from what.
- On screen in turns: the opening question, its answer; then the question on what the code needs, and its answer.
Discussion pause: Collect ideas for the first question before revealing the explanation.
In the lesson window
- Think it through: Sending the whole file back to compare would take another hour, but you can phone your colleague. What could the two of you compare that is much shorter than the file?
- Think it through: For that comparison to be trustworthy, which property of the code matters most?
2. The idea Explain 2 min
On the lesson window now
Purpose: Name the hash function and the digest, and connect them to the phone-call check.
Responses to expect
- On screen in turns: the opening; then the digest, and the fingerprint comparison.
3. Try it: two digests Experiment 5 min
On the lesson window now
Purpose: Let learners predict and see the avalanche effect in the panel before the properties are listed.
Ask
- Predict: one character differs. How much of the digest changes?
Responses to expect
- Most predict a small change. The panel shows roughly half of the bits changing.
- Panel: the panel is on screen when the step opens, so the instructor view’s jump to this step lands on it.
- On screen in turns: the opening question, its answer; then what a good hash gives you, starting with fixed length; deterministic; one-way; sensitive; no key; why it matters: integrity.
Misconceptions to challenge
- A learner may believe: “Similar inputs give similar digests.” Respond: A good hash spreads any change across the whole digest; that is what makes the check quick.
If the explanation does not land: Ask learners to type their own name into the panel, then change one letter.
In the lesson window
- Think it through: Before you look at the panel: the two messages differ by one character. How much of the 64-character digest do you expect to change?
4. A hash is not encryption Explain 5 min
On the lesson window now
Purpose: Separate hashing from encryption and encoding, starting from the information that a digest throws away.
Ask
- Could you rebuild the video from its 64-character digest?
- Where is the key that decrypts a digest?
Responses to expect
- A few think clever software could. Ask how much fits in 64 characters.
- Some will look for a key. There is none.
- On screen in turns: the opening question, its answer; then encryption and hashing, starting with encryption; hashing; the check question on decrypting a digest, and its answer; a digest cannot contain the data; encoding, encryption and hashing, side by side.
Misconceptions to challenge
- A learner may believe: “A hash is encrypted data.” Respond: Nothing of the original survives in it to decrypt.
In the lesson window
- Think it through: Your colleague reads you the 64-character digest of the 2 GB concert video. Could you rebuild the video from those 64 characters?
- Check your understanding: A colleague has a file’s SHA-256 digest and asks for the key to decrypt it back into the file. What is the best response?
5. The SHA families Explain 3 min
On the lesson window now
Purpose: Name the algorithms learners will meet and what the numbers mean.
Ask
- What does the 256 in SHA-256 tell you?
Responses to expect
- The digest length in bits; 64 hexadecimal characters.
- On screen in turns: the opening; then the SHA families, with their position today held back; each family’s position today; SHA-256 and SHA-512; MD5.
Discussion pause: The position-today column is held back: ask which families are still safe to use before revealing it.
6. What makes a hash secure Explain 6 min
On the lesson window now
Purpose: Define preimage and collision resistance, motivated by what two contracts with one digest would allow.
Ask
- Two contracts, one digest, and you approve the fair one. What can the attacker claim?
- Which is easier: matching one given digest, or finding any two inputs that match?
Responses to expect
- Most see the contract problem quickly once they recall that the approval covers the digest.
- Learners often say the two attacks are the same; the birthday step shows why they are not.
- On screen in turns: the opening; then preimage resistance; collision resistance: the question on two contracts, and its answer; no two inputs with the same digest; the collision; second-preimage resistance.
In the lesson window
- Think it through: An attacker prepares two contracts, a fair one and an unfair one, that have the same digest. You approve the digest of the fair one. What can the attacker now claim?
7. Collisions must exist Discover 8 min
On the lesson window now
Purpose: Show by counting that collisions must exist, and use the birthday puzzle to show why they are easier to find than preimages.
Ask
- Infinite inputs, 2^256 digests: can every input have its own?
- How many people for a likely shared birthday?
Responses to expect
- Many say a secure hash would never repeat. Ask them to count.
- The birthday guess is usually about 180; 23 surprises.
- On screen in turns: the opening question, its answer; then every hash has collisions; the counting argument; secure means nobody can find one; the birthday effect; the question on shared birthdays, and its answer; why the answer is 23; preimages and collisions, in numbers; why digests are twice as long.
Misconceptions to challenge
- A learner may believe: “A secure hash has no collisions.” Respond: They exist for every hash; security means nobody can find one.
If the explanation does not land: If the group is large enough, ask for birthdays aloud and see how quickly two match.
In the lesson window
- Think it through: A SHA-256 digest is always 256 bits long, but its input can be any file of any length. Can two different inputs ever produce the same digest?
- Think it through: Make a guess before reading on: how many people must be in a room before two of them probably share a birthday?
8. Why MD5 and SHA-1 are no longer suitable Explain 5 min
On the lesson window now
Purpose: Explain why MD5 and SHA-1 are unsuitable where collisions matter, and where MD5 is still met.
Ask
- Would you sign contracts using MD5 digests? Why not?
Responses to expect
- Point back to the two contracts: a signature covers a digest.
- On screen in turns: the opening; then two broken designs, starting with MD5; SHA-1; the accurate statement; the check question on MD5 for signatures, and its answer; MD5 for accidental corruption only.
In the lesson window
- Check your understanding: A team proposes using MD5 digests in a new system that signs contracts, because MD5 is fast. What is the best response?
9. Checksums and verifying a download Experiment 8 min
On the lesson window now
Purpose: Work through checking a download, and the limits of what a match proves.
Ask
- The digests differ from the first character. Do you need to read to the end?
- Your digest matches the checksum on the same page. What has that proved?
Responses to expect
- Many say “the file is safe”. Ask who could have put the checksum on the page.
- Reveal Mr Lowe’s steps one at a time; at step 4, ask what he should do before the answer appears.
- On screen in turns: the opening; then the question on what a checksum proves, and its answer; checking a download, starting with downloading it; computing its digest; finding the publisher’s checksum; comparing them; Mr Lowe checks an installer, starting with the download; the published checksum; his digest; the comparison; not installing it; downloading again; the result; why the digests look nothing alike; what the match did not tell him; what a match tells you, starting with what it does; who produced the file; how trustworthy its source is; signed checksums.
Misconceptions to challenge
- A learner may believe: “A matching checksum means the download is safe.” Respond: It shows the file matches the page, not who published either or what the file does.
In the lesson window
- Think it through: Before the steps: your download’s SHA-256 digest matches the checksum printed on the same web page. What has that proved?
10. Where hashes are used Explain 3 min
On the lesson window now
Purpose: Connect hashing to integrity checks, signatures, passwords and blockchains, each with its own lesson.
Ask
- Which of these uses would a collision attack threaten most?
Responses to expect
- Signatures and certificates.
- On screen in turns: the opening; then where hashes are used, starting with integrity checking; digital signatures; password storage; blockchains.
11. Security+ terminology Explain 2 min
On the lesson window now
Purpose: Map the lesson's terms to the Security+ objectives' wording.
Ask
- Which objective lists collision and birthday attacks?
Responses to expect
- Objective 2.4.
- On screen in turns: the opening; then what the objectives do not name.
12. Apply it in a new situation Apply 3 min
On the lesson window now
Purpose: Set up independent application, ideally on a later day.
Ask
- Who will try these now, and who later in the week?
Responses to expect
- The password question previews the next lesson on salting and stretching.
- On screen in turns: the opening; then the question on an evidence log, and its answer; the question on hashing passwords, and its answer.
In the lesson window
- Apply it: An investigator records the SHA-256 digest of a disk image when it is collected. Months later, before court, they hash the image again and the two digests match. What does that show?
- Apply it: A developer says: “We store each password as a SHA-256 digest, so the passwords are encrypted and safe.” What is the best response?
13. Check your understanding Check 3 min
On the lesson window now
Purpose: Check the lesson against the ten approved revision-bank questions.
Ask
- Answer individually, then compare before revealing.
Responses to expect
- The preimage-versus-collision question is the hardest.
- On screen in turns: the opening; then the revision questions one at a time, each followed by its answer; where to practise next.
14. What to remember Consolidate 1 min
On the lesson window now
Purpose: Summarise the five points, the key terms and the misunderstandings.
Ask
- Without looking: why must every hash have collisions?
Responses to expect
- More possible inputs than possible digests.
- On screen in turns: the opening; then the summary; the key terms; the common misunderstandings.
Lesson recap Closing
On the lesson window now
On screen: the lesson’s objectives again; Next adds the closing question, which asks the class to explain each one in their own words without looking back. It says nothing about what anyone has learnt: use the answers to decide what to revisit.
Points to listen for
- Any input in, a short fixed-length digest out, and no way back.
- No key, nothing to decrypt: hashing is not encryption.
- Collisions always exist; a secure hash makes them impossible to find in practice.
- Do not use MD5 or SHA-1 where someone could benefit from a collision.
- A checksum match tells you about the file, not about who published it.
Consolidation
- Any input in, a short fixed-length digest out, and no way back.
- No key, nothing to decrypt: hashing is not encryption.
- Collisions always exist; a secure hash makes them impossible to find in practice.
- Do not use MD5 or SHA-1 where someone could benefit from a collision.
- A checksum match tells you about the file, not about who published it.