All operations

Hash

Reduce any input to a short fixed-length fingerprint.

What it does

A hash function turns any amount of data into a short value of fixed length. The same input always gives the same output, and changing a single bit changes the result completely.

It only runs one way. There is no operation that recovers the input from the hash, which is why the output box on this page cannot be edited.

Which one to use

SHA-256 is the sensible default for anything new. SHA-384 and SHA-512 are available where a longer digest is required.

MD5 and SHA-1 are broken for any purpose that depends on two different inputs being unable to share a hash. Collisions can be produced deliberately, and have been used to forge certificates. They remain here because you will still meet them constantly in old systems, file listings and malware databases, and you need to be able to compute them to check against those.

CRC32 is not a hash at all in the security sense. It is an error-detection checksum, trivially forged, and useful only for spotting accidental corruption.

A caution about passwords

None of these should be used to store passwords, including SHA-256. They are built to be fast, and fast is exactly wrong for that job: it lets an attacker try billions of guesses per second against a stolen database. Password storage needs a deliberately slow function such as Argon2, scrypt or bcrypt.

Verification

Every algorithm here is checked against published test vectors, including RFC 1321 for MD5, the NIST vectors for the SHA-2 family, and the standard CRC32 check value of cbf43926 for the string 123456789.

HMAC adds a secret key, which is what you need to prove a message came from someone rather than merely that it has not changed.