What Is a Hash Function?
A cryptographic hash function takes any input - a word, a sentence, or an entire file - and turns it into a fixed-length string of characters called a hash (or digest). The same input always produces the exact same hash, but even a single changed character produces a completely different, unpredictable result.
Hashing is one-way: you can't reverse a hash back into the original text. That makes it useful for verifying that data hasn't been altered, fingerprinting files, and - when combined with proper salting - storing credentials without keeping the raw password.
Comparing MD5, SHA-1 & SHA-2
| Algorithm | Output Length | Typical Use | Cryptographically Secure? |
|---|---|---|---|
| MD5 | 128 bits (32 hex chars) | Legacy checksums, non-security dedup | No - broken, collisions are practical |
| SHA-1 | 160 bits (40 hex chars) | Legacy Git commit hashing, old checksums | No - broken, collisions demonstrated |
| SHA-256 | 256 bits (64 hex chars) | TLS certificates, blockchain, Git (newer) | Yes |
| SHA-384 | 384 bits (96 hex chars) | High-assurance certificates, TLS | Yes |
| SHA-512 | 512 bits (128 hex chars) | File integrity, high-security applications | Yes |
"Broken" means a deliberate attacker can craft two different inputs that produce the same hash (a collision) faster than brute force - it does not mean the hash is useless for detecting accidental file corruption.
Common Uses for Hashing
Frequently Asked Questions
No. Every hash is computed entirely in your browser using JavaScript (the native SubtleCrypto API for SHA algorithms, and a local MD5 implementation) - your text is never uploaded or sent to a server.
MD5 and SHA-1 are no longer considered cryptographically secure against a deliberate attacker, since practical collision attacks exist for both. They are still fine for basic integrity checks, checksums, and detecting accidental corruption, but should not be used for passwords, digital signatures, or anything security-critical - use SHA-256 or SHA-512 instead.
Both belong to the SHA-2 family and are considered cryptographically secure. SHA-256 produces a 256-bit (64 hex character) digest, while SHA-512 produces a 512-bit (128 hex character) digest. SHA-512 is often faster on 64-bit hardware and offers a larger security margin, while SHA-256 is more common in everyday applications like TLS certificates and Git.