Mission 1 — Algorithm Tour
Hash the same input through MD5, SHA-1, SHA-256, and SHA-512 and observe the digest, bit-length,
and relative speed. MD5 is computed with a built-in JS implementation
(Web Crypto does not offer MD5); SHA-1 through SHA-512 use the real
crypto.subtle.digest API.
Understand why MD5 and SHA-1 are retired and when SHA-256+ is required.
MD5 (128-bit) and SHA-1 (160-bit) have known practical collision attacks. FIPS 180-4 mandates SHA-256 or higher for new work. Speed is displayed for educational context; for passwords speed is the enemy — see Mission 3.
Mission 2 — MD5 Collision Demo
A hash collision occurs when two different inputs produce the exact same digest. MD5 collisions are computationally practical since Wang and Yu (2004). Below are two short binary inputs (Lenstra et al., 2005) that produce the same MD5 digest. The lab computes both hashes in your browser using the same MD5 engine as Mission 1 — you can verify the result is real.
Message A (different content)
Message B (different content)
Reference: Wang & Yu (2004) "How to Break MD5"; Lenstra et al. (2005) chosen-prefix collision construction. SHA-256 has no known practical collision attack as of NIST SP 800-107r1.
Mission 3 — Salting and Password Storage
Hashing a password naively (even with SHA-256) is dangerous: rainbow tables
pre-compute millions of common-password hashes. A random per-user salt defeats
this. PBKDF2 (Password-Based Key Derivation Function 2, NIST SP 800-132) adds
iterations to make each guess expensive. This lab uses real
crypto.subtle.deriveBits with PBKDF2-SHA256, 200,000 iterations.
User account 1
User account 2
NIST SP 800-132 recommends PBKDF2 with at least 600,000 iterations (SHA-256). This demo uses 200,000 for browser performance. Argon2id and bcrypt are also preferred options for new systems (memory-hard).
Mission 4 — HMAC: Keyed Integrity and Authenticity
A plain hash proves a message has not changed, but anyone can recompute it.
HMAC (RFC 2104) wraps a hash with a shared secret key, producing a tag that
requires the key to compute or verify. It provides both integrity (message
not altered) and authenticity (came from someone who holds the key).
This lab uses crypto.subtle.sign / verify with HMAC-SHA256.
RFC 2104: HMAC-SHA256 is the standard for API authentication tokens, TLS record MAC, and S/MIME. Unlike a signature, both sides hold the same key (symmetric). HMAC does not provide non-repudiation (either party could have computed it).
Mission 5 — Capstone: Match Primitive to Requirement
You have operated each primitive. Now specify the right hash primitive for each real-world requirement. Wrong choices — MD5, SHA-1, raw SHA-256 for passwords, a plain hash for message authentication — fail the review. The engine evaluates your config; a single mismatched or weak choice blocks certification.
Hash Deep-Dive — Certified
You operated MD5, SHA-1, SHA-256, and SHA-512 with real computation; witnessed a live MD5 collision; used PBKDF2 with random salts for password storage and verified a login; computed and broke HMAC-SHA256 to prove keyed authentication; and matched every requirement to the correct primitive with no weak links. That is the foundation of hashing as a security control.