Chapter 13 of 22 Part III: Trust, Cryptography & Security

The Digital Fingerprint

Difficulty: Applied Editorial estimate: ~55 min Prerequisites: Chapter 11

Chapter Field Guide

Measurable Learning Outcomes

  • Demonstrate the avalanche effect in SHA-256 using Web Crypto.
  • Explain how asymmetric digital signatures (ECDSA) prove both authenticity and integrity.
  • Explain how TOTP combines a shared secret with 30-second time steps via HMAC.

Core Scientific Intuition

A cryptographic hash (like SHA-256) maps any input to a fixed 256-bit digest with three key properties: deterministic, one-way (preimage resistant), and collision resistant. Digital signatures (ECDSA) sign a hash with a private key so anyone with the public key can verify it was not altered. TOTP derives a 6-digit code every 30 seconds from HMAC(secret, floor(time / 30)).

T = floor(UnixTime / 30), Code = Truncate(HMAC-SHA1(K, T)) mod 10⁶
In plain words: The 6-digit TOTP code is derived from an HMAC of the shared secret K and the current 30-second time counter T.
Units & assumptions: Standard RFC 6238 uses 30-second steps and 6 decimal digits; clocks must stay reasonably synchronized.

Worked Example

Changing "Hello" to "hello" in SHA-256 flips roughly half of all 256 output bits (the avalanche effect), making it impossible to guess how close two inputs are by inspecting their hashes.

Hands-On Exploration

Interactive Laboratory

Test the concepts directly with 3 interactive panels, live controls, and visual feedback.

Open Interactive Lab →

Three Guided Projects

Structured experiments with hypotheses, boundary tests, hints, and reflection prompts.

View 3 Projects →

Source Code (5 Snippets)

Inspect byte-identical printed JavaScript blocks, download `.js` files, or test runnable blocks in the isolated sandbox.

Browse Code →

Self-Check Quiz (5 Questions)

Immediate explanations for every choice, unlimited retries, and local-only score tracking.

Take Self-Check Quiz →

Book Chapter Outline (Reference Guide)

Section headings from Volume 1 for cross-referencing with the printed book.

Show all 28 book section headings
  1. Two certificates, one mystery
  2. PEOPLE BEHIND THE SCIENCE
  3. Ralph Merkle (born 1952)
  4. Leslie Lamport (born 1941)
  5. A fingerprint made of mathematics
  6. Three important properties
  7. One letter, a storm of changes
  8. Who protects the fingerprint?
  9. Different tools answer different questions
  10. How a website remembers a password
  11. A signature nobody can simply copy
  12. From public keys to digital trust
  13. What is a certificate?
  14. Why your six-digit code expires
  15. Project 1: make a digital fingerprint
  16. Project 2: issue a signed certificate
  17. Project 3: a code that changes with time
  18. Enter the verification laboratory
  19. Experiment A: avalanche effect
  20. Experiment B: tampered certificate
  21. Experiment C: time-based code
  22. The mystery of the missing prize
  23. Your mission
  24. What could go wrong?
  25. Invent a classroom certificate registry
  26. Invent a safer login poster
  27. Words to keep
  28. Sources and image credits

Primary Sources & Further Reading

External links are provided for independent verification and deeper study. Link availability can change over time; see the Resources page for verification notes.

Source Type Link
Read more reference https://computerhistory.org/profile/ralph-merkle/
Further reading reference https://www.nsf.gov/cise/turing-awardees
Additional reference reference https://computerhistory.org/profile/leslie-lamport/
OWASP: password storage guidance reference https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
NIST: Secure Hash Standard, FIPS 180-4 primary-standard https://www.nist.gov/publications/secure-hash-standard
NIST: Digital Signature Standard, FIPS 186-5 primary-standard https://csrc.nist.gov/pubs/fips/186-5/final
RFC 6238: Time-Based One-Time Password Algorithm reference https://www.rfc-editor.org/rfc/rfc6238.html
MDN: SubtleCrypto.digest official-docs https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
MDN: SubtleCrypto.sign official-docs https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/sign
MDN: SubtleCrypto.verify official-docs https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify
MDN: One-time passwords official-docs https://developer.mozilla.org/en-US/docs/Web/Security/Authentication/OTP
MDN: SubtleCrypto overview official-docs https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto