hash function
termcryptographyprogramming
A one-way function that turns any input into a fixed-size fingerprint.
A cryptographic hash maps data to a short digest that is practically impossible to reverse and changes completely on the smallest input change. It underpins integrity checks, password storage (with salt), and signatures; a good one makes finding two inputs with the same output (a collision) infeasible.
A cryptographic hash function turns input of any size into a fixed-size digest, and the useful properties are what it makes hard rather than what it computes. Given a digest you should not be able to find an input that produces it, given an input you should not find a second one matching it, and you should not be able to find any two colliding inputs at all.
That last property is the weakest link, because of the birthday problem: collisions become findable at roughly the square root of the output space, so a 128-bit digest offers about 64 bits of collision resistance rather than 128. This arithmetic is why MD5 and SHA-1 fell to practical collision attacks while still looking adequate by output length alone.
The most common misuse is reaching for a fast hash to store passwords. Speed is the entire point of a general-purpose hash and the entire problem for password storage, where an attacker guesses billions of candidates per second. Password hashing wants deliberate slowness and memory hardness, which is what bcrypt, scrypt and Argon2 provide and what SHA-256 emphatically does not.
Also known as: hash, hashing, digest, message digest