Unit content
Cryptographic hash functions
A cryptographic hash function maps an input of arbitrary length to a fixed-size digest:
$$h=H(m).$$
A secure cryptographic hash is designed to make several attacks computationally infeasible:
- finding an input that produces a chosen digest (preimage resistance);
- finding a second input with the same digest as a given input (second-preimage resistance);
- finding any two distinct inputs with the same digest (collision resistance).
Hashing is deterministic: the same input gives the same digest. It therefore provides no secrecy by itself.
Hashes are useful for compactly committing to data, building signatures over large messages and detecting accidental or adversarial changes when combined with an authenticated reference value.
A cryptographic hash should not be confused with the hash function used by an ordinary hash table. Hash tables need fast distribution across buckets; cryptographic hashes are designed around adversarial computational properties.