What is a Hash?
A hash is a one-way function that turns any input — a sentence, a config file, a 2GB image — into a fixed-length string of hex characters. The same input always produces the same hash (deterministic), a tiny change flips about half the output bits (the avalanche effect), and you can't reverse it: given only the hash, there is no way to recover the original data.
Why SHA-256?
MD5 and SHA-1 are legacy algorithms with known collision attacks (MD5 since 2004, SHA-1 demonstrated in 2017's SHAttered attack). SHA-2 — especially SHA-256 and SHA-512 — is the current standard, used by TLS certificates, Git commits, and blockchain systems. SHA-256 produces a 256-bit digest (64 hex characters) and has no known practical collision attack.
Common Use Cases
- File integrity: Compare the SHA-256 of a downloaded file against the publisher's checksum to confirm it wasn't corrupted or tampered with.
- API signatures: HMAC-SHA256 signs requests with a shared secret so receivers can verify authenticity and integrity.
- Deduplication: Hash content to detect duplicates without comparing full files.
- Content addressing: Git and IPFS identify objects by their SHA-1/SHA-256 hash.
💡 Pro Tip: Hashing is Not Encryption
Encryption is reversible (with a key); hashing is one-way by design. And for storing passwords, never use plain SHA-256 — it's fast, so attackers can brute-force millions of guesses per second on GPUs. Use a deliberately slow, salted password hash like bcrypt, argon2, or scrypt instead (libraries exist for every language).
Frequently Asked Questions
Can SHA-256 be reversed or decrypted?
No. SHA-256 is a one-way function with no decryption. The only "attacks" are brute force (guessing inputs until the hash matches) or rainbow tables (precomputed lookups — defeated by salting). If someone claims to "decrypt" a SHA-256 hash, they either guessed the input or the input was a known word.
What's the difference between SHA-256 and SHA-512?
Output size (256 vs 512 bits) and internal structure. SHA-512 uses 64-bit words, which makes it faster than SHA-256 on 64-bit CPUs for large inputs — but its output is twice as long. SHA-384 is SHA-512 with a truncated output, used where 256 bits feels too short but 512 is overkill. For most applications, SHA-256 is the right default.
Is this tool safe for hashing sensitive data?
Yes. The hash is computed with crypto.subtle.digest() — the browser's built-in Web Crypto API. Your input never leaves the page: there is no network request, no upload, no server. You can even disconnect from the internet and it still works.
Why shouldn't I use MD5 or SHA-1 anymore?
Both have practical collision attacks: two different inputs that produce the same hash. MD5 collisions were demonstrated in 2004 and can be computed in seconds on a laptop; SHA-1 collisions (SHAttered, 2017) cost about $110K in cloud compute. If an attacker can produce a "matching" hash for malicious content, integrity checks fail silently. Use SHA-2 (SHA-256/384/512) for anything new.
What is HMAC-SHA256?
HMAC is a keyed hash: it mixes a secret key into the hashing process so only parties who know the key can produce or verify the digest. It's the standard way to sign API requests and webhooks — a request carrying a valid HMAC could only have been signed by someone holding the shared secret.