What is a hash function?
A hash function turns any amount of data into a short, fixed-length fingerprint, such as the 256-bit output of SHA-256. The same input always gives the same hash, a tiny change gives a completely different one, and nobody can work back from the hash to the input or find two inputs with the same hash. That makes hashes useful for checking that a download or a backup has not changed, for digital signatures, which sign the hash of a document, for storing passwords safely, and for the integrity checks inside TLSTLS: Transport Layer Security. The encryption that protects most internet traffic, such as HTTPS.. Old functions have failed: MD5 and SHA-1 are broken for security purposes, and a public SHA-1 collision was demonstrated in 2017, so treat them as legacy wherever they still appear, for example in old certificates or file checks. SHA-256, SHA-384 and SHA-3 are current choices. A hash is not encryption: there is no key and nothing to decrypt. Quantum computers weaken hash functions only modestly.
Read next
Related questions
Terms used here
- TLS (Transport Layer Security)
- The encryption that protects most internet traffic, such as HTTPS.
← All 40 questions on Encryption and encrypted trafficAll topics