Hash Generator: Generate SHA Hashes and HMAC
Compute SHA-256, SHA-384, or SHA-512 in this browser with the Web Crypto SubtleCrypto digest API. Optional HMAC uses the same SHA-2 family and a secret you type. Hash UTF-8 text or a local file as an ArrayBuffer. Copy hex or Base64, then compare two digests. Nothing is uploaded or stored.
Drop a file here or choose one. It is read with File.arrayBuffer in this page only. Limit 32 MiB because Web Crypto digest is not streaming.
Text is encoded with TextEncoder as UTF-8. A trailing newline changes the digest, which is why echo and echo -n disagree.
HMAC (FIPS 198-1 / RFC 2104) proves authenticity only to holders of this key. An empty secret is rejected.
Digest
Hex is the usual checksum form (sha256sum, OpenSSL -hex). Base64 is shorter and common in APIs and HMAC headers. Both encode the same bytes.
Hex
Base64
Compare two digests
Paste a published checksum and the value just computed. Comparison is case-insensitive for hex, ignores spaces, colons, dashes, and a 0x prefix, and accepts a sha256sum first field or standard Base64. Hex can be compared to the matching Base64.
What this tool does not do
- MD5 and SHA-1 are omitted. RFC 6151 rejects MD5 where collisions matter. NIST is retiring SHA-1 (FIPS 180-5 will drop it; SP 800-131A already disallows SHA-1 for most signatures).
- SHA-224, SHA-512/224, SHA-512/256, and SHA-3 are not in the Web Crypto digest set this page calls.
- Web Crypto digest is not streaming: the whole file must fit in memory. Files over 32 MiB are rejected here; use sha256sum or openssl dgst for large images.
- SubtleCrypto needs a secure context (HTTPS or localhost). There is no Math.random fallback.
- A hash is not encryption and is not a password KDF. Do not store passwords as a single SHA-2 digest.