- Home
- Tools
- Developer Tools
- Hash Generator
Hash Generator
MD5, SHA-1, SHA-256 and SHA-512 hashes of text or files.
0 bytes as UTF-8
Hashes
MD5
–
SHA-1
–
SHA-256
–
SHA-384
–
SHA-512
–
CRC-32
–
What a hash tells you
A hash function turns any amount of data into a short value of fixed length. The same input always gives the same value, and changing a single character changes it completely. The MD5 of The quick brown fox jumps over the lazy dog is 9e107d9d372bb6826bd81d3542a419d6. Put a full stop behind the sentence and it becomes e4d909c290d0fb1ca068ffaddf22cbd0.
That makes a hash a fingerprint. If the SHA-256 of a file you downloaded equals the one the publisher lists, you have the same file, bit for bit. Drop the file above, paste the published value into Compare with, and the page tells you whether they agree and which algorithm it recognised by the length.
Which one to use
| Algorithm | Length | Where it stands |
|---|---|---|
| CRC-32 | 8 hex characters | A checksum, not a cryptographic hash. Catches transmission errors, and anyone can craft a file with a given CRC. |
| MD5 | 32 | Broken since 2004: two different files with the same MD5 can be made on purpose. |
| SHA-1 | 40 | Broken in the same way; the first collision was published in 2017. |
| SHA-256 | 64 | The usual choice today. |
| SHA-384, SHA-512 | 96, 128 | The same family as SHA-256 with longer results. |
"Broken" has a narrow meaning here. MD5 and SHA-1 still detect accidental damage, such as an incomplete download or a failing disk, as well as they ever did. What they no longer do is protect against someone who prepares two files with the same hash in advance. When the question is whether a file was tampered with, use SHA-256 and get the expected value from a place the attacker can't change.
A hash is not encryption
There is no key and no way back: the input cannot be computed from the hash. It can be guessed, though. A hash of a phone number, a postcode or a common password is found in seconds by hashing every candidate.
For the same reason these algorithms are the wrong tool for storing passwords. They are built to be fast, and guessing benefits from speed. Password storage calls for a function that is slow on purpose and salted, such as bcrypt, scrypt or Argon2.
When your result differs from the one you expected
- A line break at the end.
echo "abc" | md5sumhashes four bytes, becauseechoadds a newline. Useprintf 'abc' | md5sumto compare with what you type here. The line under the text box shows how many bytes are being hashed. - Line endings. A text box in a browser turns every line ending into a single line feed. A file saved on Windows with CR LF endings therefore hashes differently when you paste its contents. Use the File tab to hash the exact bytes.
- Encoding. Text is hashed as UTF-8. The same text saved as UTF-16 or Latin-1, or with a byte order mark in front, is a different series of bytes.
- Another CRC. CRC-32 here is the variant used by zip, gzip and PNG. The classic Unix
cksumcommand uses a different one and prints it as a decimal number.
HMAC
An HMAC mixes a secret key into the hash. Only someone who knows the key can produce the right value, which is how webhooks and API requests are signed. The key is taken as UTF-8 text. SHA-1 is included because older services still sign with it; inside an HMAC it is not affected by the collision attacks.
Files stay on your device
Everything is calculated in your browser and nothing is uploaded. Files are limited to 500 MB, because the browser's own SHA functions need the whole file in memory at once.