BC1: Hashes: fingerprints for data

Lesson 5 of 5 ยท reading 15โ€“25 minutes; practice and project time is on the module page

Using hashes well

๐ŸŽฏYou'll be able to

Choose a hash function, use it correctly in code, and explain what hashes can and can't prove.

๐Ÿ The everyday picture

A seal on a jar shows it hasn't been opened, but not who packed it. For that you need a label from someone you trust.

๐Ÿ“˜What it really is

๐Ÿ“A worked example

Input: the federation wants to publish a fingerprint of each month's accounts.

Steps:

  1. Agree the format: a CSV with fixed column order, UTF-8, Unix line endings.
  2. Hash with SHA-256, labelled "G01 accounts 2026-10".
  3. Publish the digest, signed by the secretary (BC2), so members know who published it.

Expected output: a fingerprint anyone can recompute from the same file, and a signature that shows who stands behind it.

๐ŸŒWhere it's used

๐Ÿ“Case scenario

Two offices hashed the same accounts and got different digests. One used Windows line endings and the other Unix. After agreeing the exact format, the digests matched. The lesson: a hash is only as useful as the agreement about what is being hashed.

๐Ÿ–ฑ๏ธTry it

Hash "0.50" and "0.5" with SHA-256 and compare. Success: different digests, and one sentence on why the format must be agreed first.

โš ๏ธCommon mistakes

๐Ÿ› ๏ธFor your project

Project 2's signed approvals include a domain naming the vault and the chain, so they can't be reused elsewhere.

โœ…Quick check

What can't a hash alone prove about a file?

Show the answer

Who made it, since anyone can hash a forged file and publish its hash.

Why agree the exact encoding before hashing?

Show the answer

Because different bytes for the same meaning give different hashes.

โ† PreviousCommitments and salts: hiding a value until later
ProLearners Assist