Hash Generator — SHA-256, HMAC, and File Checksums in Your Browser
Hash text or a local file with SHA-1, SHA-256, SHA-384, or SHA-512 using the browser's Web Crypto API. Turn on HMAC to sign the same input with a secret that never leaves the device. Toggle uppercase hex when a checksum list expects it. Hashing is instant, deterministic, and offline. MD5 is intentionally not offered because it is cryptographically broken.
What is cryptographic hash function?
A cryptographic hash function maps input of any size to a fixed-size digest. It is deterministic (same input produces same output), fast to compute, and practically impossible to reverse. HMAC (Hash-based Message Authentication Code) mixes a secret key with the hash so the digest also authenticates who produced it. The avalanche effect means even a single byte change completely changes the output. See: SubtleCrypto digest() and sign().
Why Use This Tool
- File integrity — Drop a download and compare the SHA-256 digest to the publisher’s checksum.
- HMAC signatures — Reproduce an API HMAC locally to debug a signing mismatch without sending the secret anywhere.
- Checksum lists — Toggle uppercase hex when a manifest or Windows-style checksum uses A–F.
- Digital signatures — Sign the hash of a document, not the full document.
- Content addressing — Use hashes as unique identifiers for content (like Git commits).
Tips
- SHA-256 is the recommended choice for most uses.
- HMAC authenticates; a bare hash only fingerprints the bytes.
- File mode hashes raw bytes, not a UTF-8 string of the file name.
- Uppercase hex is display-only — the digest is the same value.
- SHA-1 is deprecated for security but still used in Git.
- Never store raw password hashes — use bcrypt or Argon2.
How to Use the Hash Generator
Choose text or a file
Paste text, or switch to File and drop any local file. Nothing is uploaded.
Select algorithm
Choose SHA-1, SHA-256, SHA-384, or SHA-512.
Optional HMAC
Enable HMAC and type a secret. The digest becomes HMAC-SHA-* of the same bytes.
Copy the hex
Toggle uppercase if needed, then click Copy Hash. The hex never leaves this tab unless you copy it.
Worked Examples
SHA-256 hash
hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
64 hex characters (256 bits)
SHA-1 hash
hello
aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d
40 hex characters (160 bits)
HMAC-SHA-256
data: what do ya want for nothing? · key: Jefe
5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843
RFC 4231 test case 2
SHA Algorithm Comparison
| Feature | SHA-256 | SHA-1 |
|---|---|---|
| Output size | 256 bits / 64 hex | 160 bits / 40 hex |
| Security | Secure | Deprecated (collisions found) |
| Speed | Fast | Slightly faster |
| Use case | General purpose | Git (legacy), non-security |
Frequently Asked Questions
Can I reverse a hash?
No — hash functions are one-way. You cannot reverse a hash to get the original input. Attackers use rainbow tables (precomputed hash databases) against weak or unsalted hashes.
Can I hash a file?
Yes. Switch to File, drop any local file up to 50 MB, and the tool hashes the raw bytes with Web Crypto. The file never leaves the browser. Compare the digest to a published checksum to verify a download.
What is HMAC in this tool?
HMAC mixes your secret with SHA-1, SHA-256, SHA-384, or SHA-512 via SubtleCrypto.sign. Use it to reproduce API signatures. A hash without a key only checks integrity; HMAC also checks that the signer knew the secret. Decode HS256 JWTs with the JWT Debugger.
Is the HMAC secret or file uploaded?
No. Digest and HMAC both run in this tab with Web Crypto. The secret, text, and file bytes never leave the device.
Why toggle uppercase hex?
Hex is case-insensitive, but some checksum files and docs print A–F in uppercase. The toggle only changes display — it does not rehash.
Should I use SHA-1?
Not for security-sensitive applications. SHA-1 collision attacks have been demonstrated. Use SHA-256 or higher for new projects.
Why not MD5?
MD5 is not available in the browser's Web Crypto API because it is cryptographically broken. For legacy MD5 support, use a dedicated JavaScript library.
How to hash passwords safely?
Don't use raw SHA hashes for passwords. Use bcrypt, scrypt, or Argon2 — these are slow by design, making brute-force attacks expensive. Generate the secret itself with the Password Generator, then hash it with a password KDF on the server.