What makes a hash function cryptographic
Any function that maps arbitrary input to fixed-size output is a hash. A cryptographic hash adds three properties that non-cryptographic ones do not guarantee.
- Preimage resistance — Given a digest, it is infeasible to find any input that produces it. This is what makes a digest safe to publish.
- Second preimage resistance — Given one input, it is infeasible to find a different input with the same digest. This is what makes a checksum meaningful.
- Collision resistance — It is infeasible to find any two inputs that share a digest. This is the strongest requirement, and the first one to fall when an algorithm ages.
Non-cryptographic hashes such as CRC32 or MurmurHash are excellent for hash tables and error detection, and offer none of these guarantees. Using one where an adversary is involved is a security bug.