Hash Generator, HMAC & File Checksum

Text hashes, HMAC and file checksum verification

Text hashes, HMAC and file checksum verification

0 chars
MD5—
SHA-1—
SHA-256—
SHA-512—

About Hash Generator, HMAC & File Checksum

This tool has three modes. Text hash converts your input to UTF-8 bytes and computes MD5, SHA-1, SHA-256 and SHA-512 side by side. HMAC takes a secret key and a message and produces HMAC-SHA-1/256/384/512 as hex or Base64. File checksum reads a file in 8 MB chunks, computes any of CRC32, MD5, SHA-1, SHA-256, SHA-384 and SHA-512 in one pass, and compares the result with an expected value you paste in.

All three use the same building block, but they answer different questions. A file checksum asks whether the file you received is the one that was published. An HMAC asks whether a message was produced by someone holding the key and arrived unaltered. A bare hash cannot answer the second question, and none of the three is a way to store passwords.

One changed byte changes the whole digest

A hash function maps input of any length to a fixed-size digest: 128 bits for MD5 (32 hex characters), 160 for SHA-1 (40), 256 for SHA-256 (64), and 512 for SHA-512 (128). A tiny change in the input scrambles the output completely; "hello" and "Hello" differ from the first hex digit onward.

Text that looks identical can still be different bytes, and the usual culprit is a line ending. Running echo hello | md5sum in a terminal gives b1946ac9… because echo appends a newline; typing hello here gives 5d41402a…. Windows CRLF line endings, a trailing space picked up while copying, and Unicode normalization (macOS stores some filenames in decomposed NFD form) cause the same mismatch.

MD5 and SHA-1 are "broken" — but broken how?

We ask three things of a cryptographic hash. Given a digest, you should not be able to find an input for it (preimage resistance). Given a file, you should not be able to make a different file with the same digest (second-preimage resistance). And you should not be able to find any two inputs that collide (collision resistance). What fell for MD5 and SHA-1 is the third property.

Wang Xiaoyun's team published MD5 collisions in 2004, and RFC 6151 (2011) notes that by 2006 a collision could be found in about a minute on a notebook PC. In February 2017, CWI Amsterdam and Google announced SHAttered: two different PDFs with the same SHA-1 digest, produced with roughly nine quintillion SHA-1 computations — about 6,500 CPU-years and 110 GPU-years. In 2020 Gaëtan Leurent and Thomas Peyrin demonstrated a chosen-prefix collision, where the attacker picks the start of both inputs, for about US$75,000 of rented GPU time. NIST announced in December 2022 that SHA-1 should be phased out by December 31, 2030.

A collision attack matters when the attacker controls both documents: prepare a harmless contract and a harmful one with the same digest, get the harmless one signed, and the signature also fits the other. Forging a new file that matches a digest someone else already published is a second-preimage attack, and no practical one is known even for MD5. So an MD5 checksum is still fine for catching a corrupted download. When the question is whether a file is authentic and the publisher's pipeline might be hostile, use SHA-256.

File checksum mode: what a match does and doesn't prove

You can paste the contents of a SHA256SUMS file straight from a download page. The tool understands GNU format (hash, two spaces, filename) and BSD format (SHA256 (file) = hash). With several lines, it prefers the one whose filename matches the file you dropped. Without a tag, it guesses the algorithm from the length: 8 characters for CRC32, 32 for MD5, 40 for SHA-1, 64 for SHA-256, 96 for SHA-384, 128 for SHA-512.

A match means you have the file the page describes. If an attacker took over the download server and replaced both the file and the checksum list, they still match. That is why Linux distributions sign SHA256SUMS with GPG; checking that signature is what ties the file to its publisher. This tool stops at comparing digests.

CRC32 is not a cryptographic hash. It is an error-detecting code used in ZIP, PNG and Ethernet, and tweaking four bytes of a file to hit any chosen CRC32 is simple arithmetic. Treat it as a check for accidental damage only.

HMAC mode: why SHA-256(key + message) isn't enough

For signing API requests or verifying webhooks it is tempting to prepend a secret and hash. MD5, SHA-1 and SHA-256 are Merkle–Damgård constructions, and they are vulnerable to length extension: the digest is the hash's final internal state, so anyone who knows H(secret‖message) and the message length can compute H(secret‖message‖padding‖extra) without the secret. In practice that means forging a valid signature for a request with "&amount=9999" appended.

HMAC (RFC 2104) mixes the key with two different pads (ipad 0x36, opad 0x5c) and hashes twice, inner then outer. Because the outer hash wraps the inner result, length extension doesn't work. For the same reason HMAC-MD5 and HMAC-SHA-1 are barely affected by collision attacks, though RFC 6151 advises leaving HMAC-MD5 out of new protocol designs.

The key field here is text encoded as UTF-8. If a service hands you a key as a hex or Base64 string, check its docs: some expect the decoded bytes as the key, others use the string literally. Keys longer than the hash block size (64 bytes for SHA-256, 128 for SHA-384/512) are hashed first, as the spec requires.

Don't store passwords with these hashes

MD5 and the SHA family were designed to be fast, which is what you want for verifying a 4 GB download and exactly what you don't want for passwords: an attacker holding a leaked digest can test candidates at enormous rates. The MD5 of "password", 5f4dcc3b5aa765d61d8327deb882cf99, can be reversed with a web search. Password storage calls for a salted, deliberately slow function such as bcrypt, scrypt or Argon2.

Worked examples

A single newline

Input
Text mode, MD5: hello / hello followed by a newline
Output
5d41402abc4b2a76b9719d911017c592 / b1946ac92492d2347c6235b4d2611184

The second value matches echo hello | md5sum on Linux. When your digest disagrees with a server's, check trailing newlines and spaces first.

The textbook HMAC-SHA256 example

Input
Key: key / Message: The quick brown fox jumps over the lazy dog
Output
hex f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8 / Base64 97yD9DBThCSxMpjmqm+xQ+9NWaFJRhdZl0edvC0aPNg=

Hashing "keyThe quick…" as plain text gives 51729876… instead. A key-prefixed hash and an HMAC are unrelated values, so a server expecting one will reject the other.

Verifying an ISO

Input
Drop the downloaded ISO into file checksum mode and paste the whole SHA256SUMS listing
Output
The line matching the filename is picked, compared as SHA-256, and marked match or mismatch

Multi-gigabyte files are read 8 MB at a time, so memory use stays low. A mismatch usually means an interrupted download or a different release than the one listed.

How to use it

  1. Pick a tab: text hash, HMAC, or file checksum.
  2. Enter text, or a key and message, or drop a file.
  3. In file checksum mode, paste the publisher's checksum to compare.
  4. Copy the result with the button beside it.

Key terms

Collision
Two different inputs with the same digest. For MD5 and SHA-1 these can be manufactured when the attacker chooses both inputs.
Length extension
Computing H(secret‖message‖extra) from H(secret‖message) without knowing the secret. HMAC and SHA-3 are immune.
CRC32
A 32-bit error-detecting code for transmission errors; it offers no protection against deliberate changes.

Frequently asked questions

Can an MD5 hash be decrypted?

Hashes aren't encrypted, so there is nothing to decrypt. Short or common inputs can be found by hashing huge numbers of guesses and comparing, which is what the site's hash cracker does.

SHA-256 or SHA-512?

Both are comfortably secure. If you're matching another system, use what it uses; published checksum files are most often SHA-256.

The published checksum is uppercase and mine is lowercase.

Hex is case-insensitive. The tool lowercases both before comparing.

Can file mode check SHA-512?

Yes. File mode supports CRC32, MD5, SHA-1, SHA-256, SHA-384 and SHA-512. Paste a SHA512SUMS line and the tool recognizes the 128-character length and switches SHA-512 on. The in-browser SHA-512 is three to four times slower than SHA-256, though, so a multi-gigabyte file can take over a minute.

My webhook signature never matches.

Almost always the message bytes differ from what the sender signed. Parsing JSON and re-serializing it changes whitespace and key order; sign-check the raw request body exactly as received.

Related guides

Sources

Last reviewed:

Privacy and how data is handled