🔐 Developer Guide

Hash Generator Guide: MD5 vs SHA-1 vs SHA-256 Explained (2026)

📅 August 2026⏱ 9 min read✍️ ToolLoom Editorial

"Just hash it" is common advice that hides a surprising amount of nuance — which algorithm, for what purpose, and why some of the most familiar ones (MD5, SHA-1) are considered broken today. Here's what a hash actually does, how the major algorithms differ, and where each one is safe to use.

📋 In This Article
  1. What a hash function actually does
  2. MD5 vs SHA-1 vs SHA-256 vs SHA-512
  3. Why MD5 and SHA-1 are considered broken
  4. Why passwords need bcrypt, not raw hashing
  5. Verifying file integrity with checksums
  6. Worked example
  7. Other real-world uses of hashing
  8. Common mistakes when using hashes
  9. Frequently asked questions

What a Hash Function Actually Does

A hash function takes any input — a single word, a password, an entire file — and produces a fixed-length string of characters called a hash or digest. No matter how large the input is, the output is always the same length for a given algorithm. Change even a single character of the input, and the entire output changes unpredictably — this property is called the avalanche effect.

Crucially, hashing is a one-way operation. There's no key, and no legitimate way to run the process backwards to recover the original input from its hash — which is exactly what makes it useful for verification without needing to store or transmit the original data.

🔒
One-Way
No key exists to reverse a hash back to its original input.
📏
Fixed Length
A one-character input and a 10 GB file, hashed with the same algorithm, produce equal-length outputs.
Deterministic
The same input always produces the exact same hash, every time.
🌊
Avalanche Effect
One changed character produces a completely different, unpredictable output.

MD5 vs SHA-1 vs SHA-256 vs SHA-512

AlgorithmOutput SizeHex LengthSecurity Status
MD5128-bit32 charactersBroken — collisions demonstrated
SHA-1160-bit40 charactersBroken — collisions demonstrated (2017)
SHA-256256-bit64 charactersSecure — industry standard today
SHA-384384-bit96 charactersSecure — used where longer output is preferred
SHA-512512-bit128 charactersSecure — largest common output, high collision resistance
💡

For any new project needing general-purpose hashing (file checksums, data fingerprinting, blockchain-style integrity checks), SHA-256 is the safe, well-supported default. Reach for SHA-512 when you specifically need a larger output space; avoid MD5 and SHA-1 for anything security-relevant.

Why MD5 and SHA-1 Are Considered Broken

"Broken" in cryptography has a precise meaning: researchers have found a practical way to defeat one of the core guarantees the algorithm is supposed to provide. For hash functions, that guarantee is collision resistance — it should be computationally infeasible to find two different inputs that produce the same hash.

AlgorithmCollision AttackYear Demonstrated
MD5Practical collisions, since refined to be very cheap2004, worsening since
SHA-1"SHAttered" attack by Google/CWI researchers2017
⚠️

Both remain fine for low-stakes, non-adversarial uses — like quickly checking if two files are probably identical during development. Neither should be used anywhere a malicious party might deliberately try to forge a matching hash: digital signatures, certificate issuance, or password storage.

Why Passwords Need Bcrypt, Not Raw Hashing

This is one of the most common security mistakes in application development: using a fast, general-purpose hash like SHA-256 to store passwords. SHA-256 is cryptographically secure against collisions — but its speed is the problem, not its security. Modern GPUs can compute billions of SHA-256 hashes per second, which means an attacker with a stolen password database can brute-force guess enormous numbers of candidate passwords very quickly.

ApproachSpeedPassword-Safe?
Raw MD5/SHA-1/SHA-256Billions of hashes/sec on GPUNo
bcryptDeliberately slow, tunable cost factorYes
scrypt / Argon2Slow AND memory-hardYes — Argon2 is the current recommended standard

Dedicated password-hashing algorithms are deliberately slow and, in the case of scrypt and Argon2, deliberately memory-intensive — both properties that make large-scale brute-force guessing dramatically more expensive for an attacker, even with specialised cracking hardware.

Verifying File Integrity With Checksums

When you download software, many publishers list a SHA-256 (or sometimes MD5) checksum alongside the download link. Comparing this published hash against the hash of the file you actually received confirms the file wasn't corrupted during transfer or tampered with by a compromised mirror.

1

Note the published hash

Copy the checksum listed on the official download page — usually SHA-256.

2

Generate the hash of your downloaded file

Use your OS checksum utility: certutil -hashfile file.exe SHA256 on Windows, or shasum -a 256 file on macOS/Linux.

3

Compare character by character

An exact match confirms the file is byte-for-byte identical to what the publisher released.

Worked Example

Hashing the text ToolLoom with different algorithms produces completely different outputs, despite the identical input:

AlgorithmOutput Length
MD532 hex characters
SHA-140 hex characters
SHA-25664 hex characters
SHA-512128 hex characters

Even changing "ToolLoom" to "toolloom" (just capitalisation) would produce four entirely different, unrelated-looking hashes — there's no way to tell from the output that the inputs were similar. Try ToolLoom's Hash Generator to see this avalanche effect in real time, and to verify a hash against your own input instantly.

Other Real-World Uses of Hashing

Common Mistakes When Using Hashes

🔐 Generate a Hash Instantly — Free

MD5, SHA-1, SHA-256, SHA-384, SHA-512 — plus a built-in verifier. Runs entirely in your browser.

Open Hash Generator →

Frequently Asked Questions

Encryption is reversible — with the correct key, ciphertext can be decrypted back to the original data. Hashing is one-way by design: there is no key and no way to recover the original input from its hash. A hash is meant to be a fixed-length fingerprint used for verification and comparison, not a way to securely store and later retrieve the original data.
Both algorithms have known practical collision attacks — meaning researchers have demonstrated ways to construct two different inputs that produce the same hash, undermining the core guarantee a hash is supposed to provide. MD5 collisions were demonstrated in 2004 and have gotten progressively easier to produce since; SHA-1 collisions were publicly demonstrated by Google researchers in 2017 (the "SHAttered" attack). Both remain fine for non-security uses like quick duplicate-file detection, but should never be used where tamper resistance or password security matters.
SHA-256 is cryptographically secure, but it's also extremely fast — which is exactly the wrong property for password storage. A fast hash lets an attacker with a stolen password database try billions of guesses per second using modern GPUs. Dedicated password-hashing algorithms like bcrypt, scrypt, and Argon2 are deliberately slow and "memory-hard," making large-scale guessing attacks computationally expensive even with powerful hardware.
Compare the file's hash against the hash published by the source. Generate the hash of your downloaded file using your operating system's checksum utility (certutil on Windows, shasum or md5 on macOS/Linux), then compare it character-by-character against the official published hash. If they match exactly, the file is byte-for-byte identical to what the source published; any mismatch means the file was altered or corrupted in transit.
MD5 produces a 128-bit hash, shown as 32 hexadecimal characters. SHA-1 produces a 160-bit hash, shown as 40 hex characters. SHA-256 produces a 256-bit hash, shown as 64 hex characters. SHA-512 produces a 512-bit hash, shown as 128 hex characters. Longer outputs generally mean a larger space of possible hash values, which makes accidental or deliberate collisions statistically far less likely.
Not through the hash function itself — hashing is mathematically one-way. What attackers actually do is precompute hashes for enormous lists of common passwords or phrases (rainbow tables) and simply look up whether a given hash matches one they've already computed. This is why unique, unpredictable input matters for anything security-sensitive, and why fast, unsalted hashes are especially vulnerable to this lookup approach.
About ToolLoom: We build free tools for Indian students, professionals and creators. All hashing happens instantly in your browser via the Web Crypto API — nothing you type is uploaded or stored. Found an error? Email contact@toolloom.in

More from ToolLoom