What a hash is for
A hash function turns any amount of data into a short, fixed-length fingerprint. The same input always gives the same hash, and changing one bit of the input changes about half of the output bits. That makes hashes good for checking that a download arrived intact or that two files are identical.
| Algorithm | Output | Use today |
|---|---|---|
| MD5 | 128 bit, 32 hex digits | Checksums against accidental damage only. Collisions are easy to make. |
| SHA-1 | 160 bit, 40 hex digits | Legacy systems and Git object IDs. Not for new security work. |
| SHA-256 | 256 bit, 64 hex digits | The usual choice for file integrity and signatures. |
| SHA-384 / SHA-512 | 384 / 512 bit | Where a longer digest is required. |
Checking a download
- Choose the file you downloaded.
- Copy the checksum from the publisher's page into “Compare with”.
- If a row turns green, the file matches. If none does, the file is damaged or is not the one the publisher released.
Spaces, colons and upper or lower case in the pasted checksum are ignored. The file is read by your browser and is not uploaded, so the size limit is your device's memory.
Questions
Can a hash be reversed?
Not by calculation. Short or common inputs can be found by trying candidates, which is why passwords need a slow, salted algorithm such as bcrypt or Argon2 and not a plain SHA-256.
Why does my hash differ from the one in my terminal?
Most often a trailing newline. echo "text" | sha256sum hashes the text plus a line break. Use printf "text" or echo -n to match this page.
Is text hashed as UTF-8?
Yes. Non-ASCII characters are converted to UTF-8 bytes before hashing.