Generate SHA-1, SHA-256, SHA-384 & SHA-512 hashes using the Web Crypto API — 100% client-side, no data leaves your browser.
Part of the SHA-2 family, produces a 256-bit (32-byte) hash. Used in Bitcoin, SSL certificates, JWT signing, and most modern security applications. Recommended default for general-purpose integrity verification.
Produces a 512-bit (64-byte) hash. More resistant to brute-force due to longer output. Actually faster than SHA-256 on 64-bit architectures due to wider internal word size. Used where higher security margins are required.
A truncated version of SHA-512 producing 384 bits. Used in TLS 1.2/1.3 cipher suites and Subresource Integrity (SRI) hashes for web assets. A good middle ground between SHA-256 and SHA-512.
SHA-1 (160-bit) is cryptographically broken — collision attacks have been demonstrated. Use only for legacy compatibility. HMAC (Hash-based Message Authentication Code) adds a secret key to any SHA variant to produce a keyed hash for authentication, not just integrity.
| Algorithm | Output | Speed (software) | Status | Reach for it when… |
|---|---|---|---|---|
| SHA-1 | 160 bits / 40 hex chars | Fast | Deprecated (2017) | Reading legacy git object IDs, old S/MIME. Never for new signatures or certificates. |
| SHA-256 | 256 bits / 64 hex chars | Fast on 64-bit | Current standard | TLS certificates, code signing, JWT, file integrity checks, blockchain. Default choice for 99% of work. |
| SHA-384 | 384 bits / 96 hex chars | Same as SHA-512* | Current | NSA Suite B compliance, some government procurement requirements. Rarely needed outside that. |
| SHA-512 | 512 bits / 128 hex chars | Faster than SHA-256 on 64-bit CPUs | Current | Situations where you want more collision resistance and are running on 64-bit hardware. Also useful when SHA-256 output is used as a key and you need more material. |
| SHA-512/256 | 256 bits / 64 hex chars | Faster than SHA-256 on 64-bit CPUs | Current | When you want SHA-256-sized output but SHA-512 throughput on 64-bit. Used by AWS S3 Signature V4. |
* SHA-384 and SHA-512 share the same internal round function; SHA-384 just truncates earlier.
SHA-256 hashes a password in microseconds. That's the problem. A GPU cracking rig runs billions of SHA-256 ops per second. Use bcrypt, scrypt, or Argon2 for passwords — they're designed to be slow. This is probably the most common security mistake in web applications.
The SHAttered attack produced two different PDF files with the same SHA-1 hash. Chrome stopped trusting SHA-1 TLS certificates that year. If you're still accepting SHA-1 hashes as proof of identity for anything security-relevant, stop. For checksums on files you fully control, the risk is low but there's no reason not to upgrade.
A SHA-256 hash is 32 bytes. Hex encoding gives you 64 characters; Base64 gives you 44 characters (with padding). Both represent exactly the same 256-bit value. The format only matters when comparing hashes — you'll get a mismatch if one system uses hex and another uses Base64 for the same algorithm.
People sometimes ask "should I salt my SHA-256 hash?" For file integrity, no — the point is that anyone with the same file gets the same hash. For deriving keys from passwords, salting is critical, but at that point you should be using a KDF like HKDF or PBKDF2, not bare SHA. SHA + a salt is not the same as a proper KDF.
Concatenating a key and message before hashing is vulnerable to length extension attacks. The HMAC construction (RFC 2104) addresses this by XOR-ing two derived keys and running two nested hash passes. Always use HMAC if you need a keyed hash.
String comparison exits on the first differing character. An attacker can measure response time differences to guess the hash byte by byte. Use constant-time comparison: crypto.timingSafeEqual() in Node, hmac.compare_digest() in Python, or hash_equals() in PHP.
| System | How SHA-256 is used | What breaks if you swap it out |
|---|---|---|
| TLS 1.3 certificates | Signature algorithm in X.509 certs. Server proves key ownership by signing the handshake. | Browsers reject the connection. SHA-1 certs are blocked since 2017. |
| Git | Object IDs for blobs, trees, commits. Git is migrating from SHA-1 to SHA-256 (object-format sha256). | SHA-1 repo: object ID collisions are now a real concern for adversarial content hosting. |
| Bitcoin / Ethereum | Bitcoin uses double-SHA-256 for block hashing and transaction IDs. Ethereum uses Keccak-256 (not standard SHA-3). | Changing it would require a hard fork — effectively creating a new chain. |
| JWT (RS256, HS256) | The "256" refers to the hash used in the signature scheme. HS256 = HMAC-SHA256. RS256 = RSA + SHA-256. | Tokens signed with one scheme don't verify with another. The alg header tells the verifier which to use. |
| Docker image IDs | Image manifests are content-addressed with SHA-256. sha256:abc123... uniquely identifies a layer. | Two images with the same ID but different content would be indistinguishable — catastrophic for supply chain security. |
| S3 / cloud storage ETags | Often MD5 of the object content (single-part) or a derived value (multipart). Verify before assuming it's SHA. | Using SHA where MD5 is expected means your integrity check will always fail. |