Hashing and passwords
One-way functions and the logins built on them: SHA-256 and the avalanche effect, why MD5 and SHA-1 fell, salted slow password hashes, honest password strength and two-factor codes.
About 10 hours of study
Learning objectives
- Explain what a cryptographic hash promises and see the avalanche effect
- Use the birthday bound to judge a hash's collision strength
- Store and check passwords with a salt and a slow hash
- Measure password strength and explain how TOTP codes are made
Lessons
- 1
Hash functions and the avalanche effect
What a cryptographic hash such as SHA-256 promises (fixed size, one-way, collision resistant), the avalanche effect seen bit by bit, and why a hash is not encryption.
- 2
Why MD5 and SHA-1 are broken
The birthday paradox and the birthday bound, what it means for a hash to be broken, and the real collision attacks on MD5 and SHA-1 that pushed the world to SHA-256.
- 3
Storing passwords: salt and slow hashes
Why sites store a salted, slow hash instead of your password: what precomputed tables are, how a per-user salt defeats them, and how bcrypt, scrypt and Argon2 slow attackers down on purpose.
- 4
Password strength and entropy
Measuring password strength honestly: entropy as length × log₂(pool), why length beats symbols, why passphrases work, and why patterns people use make the real strength far lower.
- 5
Two-factor authentication and one-time codes
The three kinds of factor, how authenticator apps compute a fresh six-digit TOTP code every 30 seconds from a shared secret and the clock, and why passkeys resist phishing when SMS codes do not.
Module practice
- FNV-1a hashesEasy
- How many bits changed?Medium
- Find the edited log entryHard
- Shared birthdaysEasy
- When do collisions arrive?Medium
- Hunt a collisionHard
- Salt and hashEasy
- Check loginsMedium
- Salt slows a dictionary attackHard
- Entropy of a passwordEasy
- Passphrase or password?Medium
- How long to guess it?Hard
- TOTP time stepsEasy
- From HMAC to a 6-digit codeMedium
- Guessing one-time codesHard