The Maths Behind Everyday Life
The story, the formula and a worked example — see exactly where this maths shows up in the world around you.
Digital Fingerprints for Files
A hash function condenses any file into a fixed-length code.
A hash function takes input of any size and produces a fixed-size output — like a 64-character fingerprint. Change one bit of the input and the hash changes completely.
Collision Resistance
SHA-256 produces a 256-bit hash. The chance of two random files having the same hash is 1 in 2²⁵⁶ ≈ 10⁷⁷. You’d need to hash about 2¹²⁸ ≈ 3.4 × 10³⁸ files before a 50% chance of collision (birthday problem).
n = number of hashes computed
How many files for a 50% collision chance?
- 1
Birthday bound
About 5 × 10³⁸ files — far more than all files ever created
The takeaway
Hash functions create unique-enough fingerprints that finding two matching ones is practically impossible.