MD5 vs SHA-256: What Hashes Prove and Which to Use
A vendor publishes a SHA-256 checksum for a download - how do you actually use it? Why can't you "decrypt" a hash? And is MD5 still usable in 2026? All three answers follow from what a hash function can and cannot prove.
- Hashes are one-way - recovering the input from a digest requires brute force, so "decrypting a hash" does not exist
- Output lengths differ by algorithm: MD5 is 32 hex characters, SHA-1 is 40, SHA-256 is 64, SHA-512 is 128
- MD5 and SHA-1 are broken for adversarial uses such as signatures and certificates, but remain adequate for detecting accidental corruption
- The same input always produces the same digest, and changing a single byte changes the entire output
- Storing a bare hash is still unsafe for passwords: unsalted MD5 falls to a rainbow table instantly, so passwords need a per-user salt and a deliberately slow algorithm
#What a hash actually proves
A hash function compresses data of any length into a fixed-length digest, and the process cannot be reversed. Three properties follow from that:
- Deterministic - the same data always produces the same digest. Change one byte and the entire output changes.
- One-way - you can compute a digest from the input, never the input from the digest. So-called "hash cracking" is dictionary lookup: hash candidates and compare. It is brute force, not mathematics.
- Collision-resistant - it should be infeasible to find two different inputs with the same digest. How strong that guarantee is separates MD5 from SHA-256.
That is why a checksum answers exactly one question: *is this the same data I expected?* Did the download complete, did the transfer corrupt anything.
#Digests and their lengths
Length is your quickest sanity check - if a value is 32 characters, no SHA-256 produced it.
| Algorithm | Output | Hex length | Status in 2026 |
|---|---|---|---|
| MD5 | 128 bits | 32 chars | Collisions constructible; integrity checks only |
| SHA-1 | 160 bits | 40 chars | Collisions constructible (SHAttered, 2017); avoid for new work |
| SHA-256 | 256 bits | 64 chars | No practical collisions; the default choice |
| SHA-512 | 512 bits | 128 chars | Stronger but longer; rarely necessary |
MD5 must not be used for digital signatures, certificates, code signing, or any tamper protection against a motivated attacker. Colliding file pairs can be constructed deliberately, so a matching MD5 proves nothing. It is still fine for detecting accidental corruption, because those errors are random rather than crafted.
#Verify a download in three steps
- Open SHA Hash, or MD5 Hash if the publisher only provides MD5.
- Drop the file into the upload area. It is read and hashed locally in your browser, so the file is never uploaded.
- Compare against the published checksum character by character. Partial matches mean nothing.
Never compare hashes by eye. A single differing character means a completely different dataset, so put both strings side by side with the Text Diff tool instead of scanning them manually.
On the command line you should get an identical result:
# macOS / Linux
shasum -a 256 package.tar.gz
md5sum package.tar.gz
# Windows PowerShell
Get-FileHash package.tar.gz -Algorithm SHA256#Why salting is not optional for passwords
Unsalted hashes fail for passwords because the input space is tiny, not because the algorithm is weak. Common passwords number in the hundreds of thousands, so an attacker can precompute a plaintext-to-digest table (a rainbow table) and look up any hash in milliseconds.
Salting prepends a unique random string per user before hashing, so identical passwords produce unrelated digests across accounts and sites:
| Storage scheme | What an attacker does after a database leak | Verdict |
|---|---|---|
md5(password) | Rainbow table lookup; common passwords fall instantly | Unusable |
md5(password + one global salt) | One break covers the whole site | Not enough |
md5(password + per-user salt) | Must brute force each user individually | Better, but MD5 is still too fast |
| bcrypt / scrypt / Argon2 | Algorithm is deliberately slow, brute force becomes expensive | Recommended |
What matters is not which hash you pick but how slow it is. MD5 and SHA-256 are optimized for speed, which is precisely the wrong property for password storage. Use bcrypt, scrypt or Argon2 with a tunable cost factor.
#A UUID is not a hash
These two appear together often and are unrelated:
- A hash is a digest of existing data. Same input, same output, fixed length.
- A UUID is a generated identifier with no input. Use UUID / GUID Generator to assign unique IDs to database rows, sessions or requests.
Need a unique identifier? Use a UUID. Need to detect whether data changed? Use a hash. Using a hash as an ID brings two problems: collisions are theoretically possible, and if the ID is derived from user input it becomes predictable.
#Cheat sheet
| Goal | Tool | Note |
|---|---|---|
| Verify a downloaded file | SHA Hash, pick SHA-256 | Compare against the published digest |
| Legacy system expects MD5 | MD5 Hash | Fine for compatibility, do not introduce it in new code |
| Sign API requests | SHA-256 or stronger | Pair it with a secret key (HMAC); a bare hash proves nothing |
| Store user passwords | bcrypt / scrypt / Argon2 | Do not run real passwords through an online tool |
| Generate unique IDs | UUID / GUID Generator | Not a hash |
| Encode data for transport | Base64 Encoder / Decoder | Also not a hash, and reversible |
#Frequently asked questions
#Can a hash be decrypted?
No, and "hash decryption" does not exist as an operation. Sites claiming to decrypt MD5 work by storing a huge lookup table of plaintext-to-digest pairs. Your hash is shown as plaintext only if it is already in the table. Short, common passwords "decrypt" because they are in the dictionary, not because the algorithm was broken.
#Is MD5 still usable at all?
It depends on the threat model. For integrity against accidental corruption - truncated downloads, damaged transfers - it works, because those failures are random. For anything adversarial - signatures, certificates, tamper protection, password storage - it does not, because collision attacks are public and practical.
#Why do I get a different hash for the same file on Windows and Linux?
Suspect the file first. Text-mode transfers on Windows rewrite \n to \r\n, which changes the bytes and therefore the digest. Re-transfer in binary mode. More rarely, two commands default to different algorithms - pass the algorithm explicitly to be sure.
#Is SHA-256 much slower than MD5?
Not in any way that matters for everyday use. On modern CPUs SHA-256 is roughly twice as slow, which on a tens-of-megabytes file is still a matter of milliseconds to a few hundred. Choose on security grounds, not speed.
#Does a longer hash always mean better security?
Up to a point. SHA-512 has a longer digest and a higher theoretical strength, at the cost of longer values to store and transmit. SHA-256 is the practical default, and going longer is rarely necessary outside specific compliance requirements.
Tools used in this guide
Generate a 32-character MD5 digest for text or a whole file
Open tool →SHA HashSHA-1 / SHA-256 / SHA-512 hash generator for text or files
Open tool →Text DiffSide-by-side line diff with add/delete highlight
Open tool →UUID / GUID GeneratorGenerate UUID v4 random, v1 timestamp, v7 sortable
Open tool →Base64 Encode/DecodeEncode and decode Base64 text with UTF-8 support; use the image tool for files
Open tool →