liveBook · Manning

Hash collision

As explained in Software Security for Developers

A hash collision occurs when two different inputs produce the same hash value.

A hash collision occurs when two different inputs produce the same hash value. Hash functions accept inputs of any size but return fixed-size outputs, so cryptographic hash functions are designed to make finding such pairs infeasible. section 4.2.1

Collision resistance is a security property, not a promise that collisions are impossible. Use standardized, peer-reviewed cryptographic hash functions rather than designing one, because secure hash-function design requires extensive mathematical analysis and scrutiny. section 4.2.1

Different inputs, fixed-size hashes

SHA-256 maps a one-byte lowercase “a,” a one-byte uppercase “A,” and a 2.6GB file to distinct 256-bit hexadecimal values. These examples illustrate the expected behavior; a collision would mean two different inputs shared one value. section 4.2.1

How Software Security for Developers covers it

How deep it goes
Defines collisions and collision resistance, but defers the mathematical design and assessment of secure hash functions.
Examples
Uses SHA-256 values for lowercase and uppercase letters and a large disk image to show fixed-size outputs.
What it assumes
Introduces arbitrary-size inputs, fixed-size outputs, deterministic hashing, and one-wayness before discussing collision resistance.
What you can do after
Evaluate hash-function choices and avoid designing custom cryptographic hash functions.
How it connects
Connects hash collisions to cryptographic hash functions, SHA-256, one-wayness, and collision resistance.

Also explained in

Compare how 4 books explain hash collision →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.