Jul 23, 2026
5 min read
A hash function takes any input — a password, a file, the complete works of Shakespeare — and produces a fixed-size fingerprint called a hash or digest. Three properties make this useful:
See it yourself in the free Hash Generator: hash the word hello, then hash Hello. One capital letter, and every character of the output is different. That sensitivity is the point — a hash is a tamper-evident seal for data.
Hashes are everywhere: verifying downloaded files, storing passwords, Git commit IDs, blockchain blocks, and digital signatures all rest on hash functions.
MD5 (1992) produces a 128-bit hash — 32 hex characters. For a decade it was the hash function. Then cryptographers broke it.
The fatal flaw is collisions: two different inputs that produce the same MD5 hash. A secure hash function makes finding collisions computationally infeasible. For MD5, researchers demonstrated practical collisions in 2004; today a laptop finds one in seconds. Attackers have exploited this in the real world — most famously, the Flame malware used an MD5 collision to forge a Microsoft code-signing certificate.
What collision weakness means practically: an attacker can craft a malicious file with the same MD5 hash as a legitimate one. The tamper-evident seal can be forged.
Is MD5 ever acceptable? For non-security uses only — cache keys, hash-table bucketing, quick duplicate detection where no attacker exists. The moment integrity or security matters, MD5 is disqualified.
SHA-256 belongs to the SHA-2 family (2001) and produces a 256-bit hash — 64 hex characters. No practical collision or preimage attack against it is known, and it is the workhorse of modern security: TLS certificates, operating-system package verification, Bitcoin, and government standards (NIST) all use it.
| MD5 | SHA-256 | |
|---|---|---|
| Output size | 128 bits (32 hex chars) | 256 bits (64 hex chars) |
| Year introduced | 1992 | 2001 |
| Collisions found? | Yes — trivially, since 2004 | None known |
| Safe for security use? | No | Yes |
| Speed | Faster | Fast enough (hardware-accelerated on modern CPUs) |
| Use today | Non-security fingerprinting only | Checksums, signatures, integrity, certificates |
MD5's remaining advantage — raw speed — is irrelevant for security purposes and actively harmful for passwords, as the next section explains.
Here is the nuance that separates a good answer from a great one in a security course: SHA-256 alone is also wrong for passwords — for the opposite reason MD5 is wrong for signatures.
General-purpose hashes are designed to be fast. But when a database of hashed passwords leaks, speed helps the attacker: a modern GPU computes billions of SHA-256 hashes per second, brute-forcing every common password in minutes.
Password storage therefore uses deliberately slow, salted algorithms — bcrypt, scrypt, or Argon2 — which are tunably expensive to compute, and which add a unique random salt per password so identical passwords produce different hashes and precomputed "rainbow tables" are useless.
The hierarchy to remember:
You will do this constantly as a developer. A site publishes a SHA-256 checksum next to its download; after downloading, you hash the file locally and compare:
# macOS / Linux
shasum -a 256 downloaded-installer.dmg
# Windows PowerShell
Get-FileHash downloaded-installer.exe -Algorithm SHA256
If your computed hash matches the published one character-for-character, the file arrived intact and untampered. If even one character differs, do not run the file.
For quick text-based experiments — comparing algorithm outputs, checking what a hash of your input looks like, or completing a coursework exercise — the Hash Generator computes MD5, SHA-1, SHA-256, and SHA-512 side by side, entirely in your browser.
If a security or cryptography assignment goes deeper than this — implementing hash functions, analyzing attacks, or building authentication — the programming help service at EduSupport can connect you with developers who can walk you through it, concept by concept.
Our expert team is available 24/7 for assignments, projects, and exam prep.