What a hash is
A hash function turns any amount of data into a short, fixed-length fingerprint. The same input always gives the same hash, and changing even one character gives a completely different one. That makes hashes useful for checking that a download or file hasn't changed.
SHA-256 → 256 bits (64) · SHA-384 → 384 bits (96) · SHA-512 → 512 bits (128)
The SHA hashes are computed by your browser's built-in Web Crypto API, which implements the NIST FIPS 180-4 standard. Browsers don't include MD5, so it uses a small JavaScript version of RFC 1321, checked against the RFC's test values. Text is converted to bytes as UTF-8 first, so "é" is hashed as two bytes.
Worked example: the standard test string "abc"
| Algorithm | Bits | Hash of "abc" |
|---|---|---|
| MD5 | 128 | 900150983cd24fb0d6963f7d28e17f72 |
| SHA-1 | 160 | a9993e364706816aba3e25717850c26c9cd0d89d |
| SHA-256 | 256 | ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad |
The MD5 value is listed in RFC 1321's test suite, and Python's hashlib gives the same values for all of them. Type abc above and you'll get the same results. Add a single space and every hash changes.
Which hash to use
- SHA-256 is the usual choice for checking downloads and for anything security-related.
- MD5 and SHA-1 are still fine for spotting accidental corruption, but they're broken for security: people can deliberately make two different files with the same hash. RFC 6151 says MD5 is no longer acceptable where collision resistance is required.
- Passwords shouldn't be stored as a plain hash of any kind. Use a slow, salted password hash like bcrypt, scrypt or Argon2.
Why your hash might not match
- A trailing newline.
echo "abc" | sha256sumhashes "abc" plus a newline, so it won't match. Useecho -norprintf. - Line endings. Windows files often use CRLF line endings; text typed here uses LF. Hash the file itself to avoid this.
- Encoding and spaces. Hidden spaces, tabs or a different text encoding change the bytes, and so the hash.
- Case. Hex hashes are the same in upper or lower case. The compare box ignores case.