Pick the wrong hash function today and you may face a painful migration before 2030. SHA-256 vs SHA3-256 is the most consequential cryptography decision for engineers building secure systems in 2026, and the choice is not obvious. Both algorithms produce a 256-bit digest. Both carry NIST approval. Both offer 128-bit collision resistance. Yet they differ in architecture, performance, and long-term security posture in ways that matter enormously depending on your deployment context.
Benchmarks from Kerkour’s 2025 analysis show SHA-256 running at 822 MB/s versus SHA3-256’s 246 MB/s for small 64-byte inputs on an AMD EPYC 4245P (Zen 5), a 3.3x throughput gap that closes somewhat at larger data sizes but never disappears. That speed advantage traces directly to SHA-NI hardware acceleration and SHA-256’s decade of optimization on x86 and ARM silicon. SHA3-256, by contrast, brings a structurally different Keccak sponge construction that eliminates an entire class of length extension attacks and positions it better for post-quantum migration timelines, including Australia’s ASD guidance that SHA-256 will not be approved beyond 2030 due to projected quantum computing advances.
This guide unpacks every dimension of the comparison: architecture, speed benchmarks across three hardware platforms, security analysis, NIST standards status, Node.js implementation examples, real-world adoption, and a clear verdict with data.
SHA-256 vs SHA3-256: Core Architecture
SHA-256 and SHA3-256 both output a 256-bit digest, but they are entirely different algorithms with no shared lineage. Understanding their internal designs is the foundation for every performance and security difference that follows.
The Merkle-Damgard Construction (SHA-256)
SHA-256 belongs to the SHA-2 family, standardized by NIST in 2001 under FIPS 180-4. It uses the Merkle-Damgard construction: the message is padded to a multiple of 512 bits, then processed in 512-bit blocks. Each block feeds into a compression function that updates a 256-bit chaining variable. The final chaining variable becomes the hash digest.
This construction has one well-documented structural weakness: length extension attacks. If an attacker knows SHA-256(secret || message) and the length of the secret but not its value, they can compute SHA-256(secret || message || padding || extension) without knowing the secret. This matters in naive HMAC-like constructions and API authentication schemes. The fix is to use HMAC-SHA256 rather than raw SHA-256 for keyed hashing, which properly domain-separates the key.
The NSA designed SHA-256 to use 64 rounds of mixing with 32-bit word operations, chosen for efficient implementation on 32-bit hardware of the early 2000s. The algorithm was later optimized heavily for 64-bit CPUs via SIMD (AVX2, AVX-512) and dedicated SHA-NI instructions introduced by Intel in Goldmont (2016) and AMD in Zen (2017). SHA-256 also benefits from 25 years of continuous optimization across compilers, runtimes, and hardware pipelines. No equivalent optimization history exists for SHA3-256.
The Keccak Sponge Construction (SHA3-256)
SHA3-256 belongs to the SHA-3 family, standardized by NIST in 2015 under FIPS 202 after a six-year open competition. It uses the Keccak sponge construction, designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche. The algorithm is completely unrelated to SHA-2 at the mathematical level. The Keccak team won the NIST SHA-3 competition against 51 candidates in 2012, beating algorithms including BLAKE, Grøstl, JH, and Skein.
The sponge works in two phases: an absorbing phase where input is XOR’d into a 1600-bit internal state and permuted through 24 rounds of the Keccak-f[1600] permutation, and a squeezing phase where output bits are extracted from the state. The 1600-bit state is partitioned into a 1088-bit “rate” (the part exposed to input/output) and a 512-bit “capacity” (the security parameter). SHA3-256’s capacity is 512 bits, giving 256-bit collision resistance.
The sponge construction inherently prevents length extension attacks because the capacity portion of the internal state is never directly output and never directly absorbs input, making it impossible for an attacker to pick up where the hash left off. This structural security advantage does not require HMAC wrapping. The SHA-3 family also includes SHAKE128 and SHAKE256, extendable output functions (XOFs) that can produce variable-length digests from the same sponge construction, enabling use cases impossible with fixed-output SHA-256.
Full Specs Comparison Table
The table below covers every dimension engineers need when choosing between these algorithms. Data comes from NIST FIPS 180-4, NIST FIPS 202, and Kerkour’s 2025 benchmark analysis.
| Specification | SHA-256 | SHA3-256 |
|---|---|---|
| Standard family | SHA-2 (FIPS 180-4) | SHA-3 (FIPS 202) |
| Year standardized | 2001 | 2015 |
| Internal construction | Merkle-Damgard | Keccak sponge |
| Internal state size | 256 bits (chaining value) | 1600 bits (b = r + c) |
| Block / rate size | 512 bits | 1088 bits (rate r) |
| Capacity | N/A | 512 bits |
| Output (digest) size | 256 bits | 256 bits |
| Rounds | 64 | 24 (Keccak-f[1600]) |
| Collision resistance | 128-bit | 128-bit |
| Preimage resistance | 256-bit | 256-bit |
| Length extension attack | Vulnerable | Not vulnerable |
| Hardware acceleration | SHA-NI (x86 + ARM) | No dedicated ISA (software) |
| NIST approval status | Approved (FIPS 180-4) | Approved (FIPS 202) |
| Variants in family | SHA-224, 256, 384, 512 | SHA3-224, 256, 384, 512 + SHAKE128/256 |
| Designed by | NSA | Keccak Team (open competition) |
| Small-input speed (64B, Zen 5) | 822 MB/s | 246 MB/s |
| Large-input speed (1MB, Zen 5) | 2373 MB/s | 686 MB/s |
| Common deployments | Bitcoin, TLS, JWT, S/MIME | Ethereum (Keccak-256), ML-DSA, ML-KEM |
Performance Benchmarks: 3 Hardware Platforms
Raw speed data is the most debated aspect of the SHA-256 vs SHA3-256 comparison. The answer depends heavily on the hardware platform, input size, and whether hardware acceleration is available. Data below comes from Kerkour’s 2025 benchmark suite and the Solana Research forum’s multi-message hashing analysis, both conducted on current-generation hardware.
x86_64: AMD EPYC 4245P (Zen 5)
The AMD EPYC 4245P running Zen 5 microarchitecture supports SHA-NI extensions, giving SHA-256 a significant hardware advantage. Results from Kerkour’s December 2024 benchmark (updated January 2025):
| Input size | SHA-256 (MB/s) | SHA3-256 (MB/s) | SHA-256 advantage |
|---|---|---|---|
| 64 bytes | 822 | 246 | 3.3x faster |
| 1 KB | 2123 | 620 | 3.4x faster |
| 16 KB | 2354 | 682 | 3.5x faster |
| 64 KB | 2369 | 686 | 3.5x faster |
| 1 MB | 2373 | 686 | 3.5x faster |
SHA-256 saturates its throughput ceiling quickly on Zen 5 because SHA-NI instructions pipeline at approximately 1 cycle per SHA-256 block. SHA3-256, relying on software Keccak permutations using AVX2 SIMD, scales linearly with input but hits a lower ceiling. The throughput ratio stabilizes at approximately 3.5x for inputs above 16 KB, which represents the steady-state performance difference for large file hashing.
ARM64: AWS Graviton 4
The AWS Graviton 4 is a 2024-generation ARM Neoverse V2 processor that includes ARM’s SHA2 cryptographic extensions, which accelerate SHA-256 similarly to Intel’s SHA-NI. From the same Kerkour benchmark suite:
| Input size | SHA-256 (MB/s) | SHA3-256 (MB/s) | SHA-256 advantage |
|---|---|---|---|
| 64 bytes | 825 | 194 | 4.3x faster |
| 1 KB | 1716 | 455 | 3.8x faster |
| 16 KB | 1742 | 507 | 3.4x faster |
| 10 MB | 1744 | 510 | 3.4x faster |
SHA-256 on Graviton 4 is actually marginally faster than on Zen 5 at small inputs (825 vs 822 MB/s at 64 bytes) due to the Graviton 4’s efficient SHA2 instruction pipeline. SHA3-256 is notably slower on ARM (194 vs 246 MB/s at 64 bytes) because Graviton 4 has no dedicated Keccak hardware path, relying entirely on NEON SIMD software optimization. The gap is largest at 64 bytes (4.3x) and narrows to 3.4x for large data. This makes Graviton 4, a popular and cost-effective cloud compute choice, one of the worst-case platforms for SHA3-256 relative performance.
Multi-Message Hashing: x86 AVX-512 (Solana Research)
The Solana Research forum analyzed multi-message SHA-256 implementations using AVX2 and AVX-512 in detailed benchmarks from late 2023, cited in ongoing 2025 discussions about hash function selection. Optimized SHA-256 batch implementations using minio/sha256-simd (Go) and fd_sha256 (C) reach approximately 10 Gbps per core on Zen 2 with AVX2 and approximately 20 Gbps per core on Ice Lake with AVX-512 for small-message batch hashing. SHA3-256 has no equivalent multi-message batch implementation available as of mid-2026, making the throughput gap even wider for high-volume applications like blockchain validators, certificate transparency logs, or content-addressable storage systems.
The practical takeaway: if you are hashing millions of small messages per second, SHA-256 with multi-message batching outperforms SHA3-256 by a margin that no software optimization of SHA3-256 can currently close. For single large file integrity checks or API token generation where you hash one object at a time, the gap narrows to approximately 3.4x in favor of SHA-256, which is measurable but often not the bottleneck in real applications where network I/O and database latency dominate.
Security Analysis: Where the Two Algorithms Differ
From a practical security standpoint, SHA-256 and SHA3-256 are both unbroken as of June 2026. No collision has been found for either algorithm. No practical preimage attack exists. The security differences are structural rather than exploited-in-the-wild vulnerabilities, but they matter for threat modeling and protocol design.
Collision Resistance and Preimage Resistance
Both SHA-256 and SHA3-256 produce 256-bit digests, so their generic security levels are identical by design. Finding a collision (two inputs with the same hash) requires approximately 2^128 hash operations, and finding a preimage (an input for a given hash) requires approximately 2^256 operations. These numbers are well beyond any classical computing capability that exists or is projected to exist, which is why NIST approves both for the same security applications.
SHA3-256’s sponge construction means its collision resistance is backed by the capacity parameter (512 bits), not just the output size. In theory this provides a security margin beyond what the output size alone implies. For SHA3-256, the capacity is twice the collision resistance level (512 bits of capacity vs 128-bit collision resistance). SHA-256 has no equivalent capacity parameter, since Merkle-Damgard’s security derives entirely from the compression function and the chaining structure. In practice, both algorithms offer the same 128-bit collision security for 256-bit outputs, and no attack known today meaningfully distinguishes them.
Quantum Computing Threat Model
Grover’s algorithm provides a quadratic speedup for preimage attacks on hash functions using a quantum computer. Against a 256-bit hash, Grover’s algorithm reduces preimage resistance from 2^256 to approximately 2^128 operations. This means both SHA-256 and SHA3-256 retain roughly 128-bit quantum preimage security, which is still considered sufficient under current NIST post-quantum guidance for hash functions specifically.
For collision attacks, the BHT (Brassard-Hoyer-Tapp) quantum algorithm reduces collision resistance from 2^128 to approximately 2^85 classical equivalents. Both SHA-256 and SHA3-256 are affected equally. Security researchers and NIST generally consider 128-bit preimage and 85-bit quantum collision resistance adequate for the foreseeable future, with NIST SP 800-57 recommending 128-bit security levels through 2031.
Length Extension Attacks: SHA-256’s Known Structural Risk
The length extension attack is the most practically important security difference between SHA-256 and SHA3-256 for developers. It is not a theoretical concern: it has been used in real-world API exploits and affects naive implementations of keyed hashing patterns that appear regularly in codebases.
The attack works because SHA-256’s Merkle-Damgard construction exposes its full internal state as the hash output. If you know SHA-256(secret || message), you know the internal chaining state after processing “secret || message”. You can then extend the computation by feeding the permutation additional data, computing SHA-256(secret || message || padding || attacker_data) without knowing the secret. The attacker only needs to know the length of the secret (which is often derivable from the context or guessable).
A concrete attack scenario: a web application uses sha256($api_key . $request_body) to authenticate API calls. An attacker who intercepts a valid authenticated request can forge new requests with arbitrary data appended, without ever knowing the api_key. This exact pattern affected the Flickr API in 2009 and has resurfaced in custom-rolled authentication schemes built on raw SHA-256 without HMAC wrapping. Major bug bounty programs report this class of vulnerability regularly, typically rated medium to high severity.
SHA3-256 is immune to length extension attacks by construction. The sponge capacity (512 bits) is never exposed in the output and never directly absorbs input, making it impossible for an attacker to recover or continue the internal state. SHAKE128 and SHAKE256 also carry this immunity.
The correct mitigation for SHA-256 is HMAC-SHA256, which wraps the hash in a keyed construction that blocks length extension by double-hashing with key XOR padding. If you are already using HMAC-SHA256 for all keyed hashing, the length extension vulnerability in raw SHA-256 is not exploitable in your system. If you use raw SHA-256 for any keyed purpose or message authentication, switch to HMAC-SHA256 immediately or migrate to SHA3-256 for new protocol design.
Hardware Acceleration: SHA-NI vs Software Keccak
The performance gap between SHA-256 and SHA3-256 exists almost entirely because of hardware acceleration, not because SHA-256’s algorithm is inherently simpler or faster at a mathematical level. The Keccak-f permutation is a clean, well-structured function. Its software performance is genuinely competitive in cases without dedicated hardware. The problem is dedicated hardware exists for SHA-256 and does not exist for SHA3-256 on mainstream CPUs.
SHA-NI (SHA New Instructions) are CPU instructions introduced by Intel in the Goldmont microarchitecture (2016, Atom-based) and later in Cannon Lake (2018, consumer), and by AMD in Zen (2017). SHA-NI provides dedicated hardware for the SHA-256 message schedule and compression function, reducing the instruction count per block dramatically. The key instructions are SHA256RNDS2 (two rounds of SHA-256 compression in a single cycle), SHA256MSG1, and SHA256MSG2. These instructions allow a single core to sustain over 2 GB/s SHA-256 throughput at large input sizes, as the benchmark data confirms.
ARM’s equivalent, included in ARMv8 Cryptography Extensions, provides SHA1H, SHA256H, SHA256H2, SHA256SU0, and SHA256SU1 instructions. AWS Graviton 2, 3, and 4 all support these extensions. Apple M-series chips, Qualcomm Snapdragon, and most modern ARM server chips also include them. SHA-256 hardware acceleration is effectively universal on hardware manufactured after 2017.
SHA3-256 has no dedicated ISA support on mainstream CPUs as of 2026. The best SHA3-256 implementations use AVX2 on x86 or NEON on ARM to implement the Keccak-f permutation in SIMD, but software SIMD cannot match hardware-dedicated SHA-NI throughput. Some embedded security processors (STM32L5, Microchip ATECC608, some HSMs) include hardware Keccak/SHA-3 accelerators, making SHA3-256 faster than SHA-256 in those constrained environments. But for commodity server deployments on x86 or ARM, SHA3-256 is always the slower option.
The hardware acceleration gap will likely narrow. ARM’s Cryptographic Extension specification was updated in 2022 to include SHA-512 acceleration, and future extensions for SHA-3 acceleration have been discussed in the cryptographic community. Intel and AMD have not announced SHA3-NI equivalent instructions, but the ongoing standardization of SHA-3 in protocols may eventually drive hardware investment. For now, plan around the current 3-4x gap on mainstream server hardware.
NIST Standards Status: FIPS 180-4 vs FIPS 202
Both SHA-256 and SHA3-256 carry full NIST approval, but under different standards documents with different histories and design rationales.
SHA-256 (FIPS 180-4): The Secure Hash Standard, with SHA-256 first appearing in the 2001 edition and the current revision published in 2015. SHA-256 is approved for all general-purpose cryptographic hash uses including digital signatures, HMAC, key derivation functions, pseudorandom number generation, and data integrity. NIST has not announced a deprecation timeline for SHA-256 in US federal guidance. NIST SP 800-131A (latest revision) currently approves SHA-2 family algorithms for use through at least 2030.
SHA3-256 (FIPS 202): The SHA-3 Standard, published by NIST on August 5, 2015 following the Keccak algorithm’s selection as the SHA-3 winner in October 2012. FIPS 202 defines four fixed-length SHA-3 variants (SHA3-224, SHA3-256, SHA3-384, SHA3-512) and two extendable output functions (SHAKE128, SHAKE256). The NIST Hash Functions page explicitly states that the fixed-length SHA-3 algorithms are “approved hash algorithms, providing alternatives to the SHA-2 family of hash functions.”
For US federal systems subject to FIPS 140-3, both algorithms are valid choices. NIST’s current position is coexistence: SHA-2 for backward compatibility and wide deployment, SHA-3 when a different construction is preferred or when protocol design explicitly benefits from the sponge structure. No US regulatory body mandates migrating from SHA-256 to SHA3-256 for existing systems.
The EU NIS2 Directive and ENISA cryptographic guidelines align with NIST and accept both SHA-2 and SHA-3. No major regulatory body outside Australia has set a concrete deprecation date for SHA-256 as of June 2026. Engineers designing for PCI DSS, ISO 27001, SOC 2, or HIPAA environments can use SHA-256 without concern through at least 2030 under all major frameworks except Australia’s ASD ISM.
Post-Quantum Considerations and the 2030 Horizon
The post-quantum cryptography conversation primarily concerns public-key algorithms such as RSA, ECDSA, and Diffie-Hellman, which are broken by Shor’s algorithm on a sufficiently powerful quantum computer. Hash functions are far less vulnerable: Grover’s algorithm provides only a quadratic speedup, meaning a 256-bit hash retains approximately 128-bit security against quantum preimage attacks, and 85-bit security against quantum collision attacks (BHT algorithm).
The ASD (Australian Signals Directorate) published guidelines in December 2024 that go further than US guidance. Their Information Security Manual states that SHA-224 and SHA-256 will not be approved for use beyond 2030 due to projected quantum computing advances. The same guidance restricts SHA-3 and XOF approval (SHA3-256, SHA3-512, SHAKE128, SHAKE256) to use within internal steps of post-quantum algorithms ML-DSA (CRYSTALS-Dilithium, the post-quantum signature standard based on lattice cryptography) and ML-KEM (CRYSTALS-Kyber, the post-quantum key encapsulation mechanism). For general-purpose hashing, only SHA-2 algorithms remain approved under ASD’s 2024 ISM, which is a conservative posture that limits both SHA-2 and SHA-3 in different ways.
This ASD guidance creates a nuanced situation: SHA-256 is deprecated beyond 2030, but SHA3-256 is also not simply approved as a replacement for general hashing. The ASD’s framework reflects an extremely conservative interpretation that treats even 128-bit quantum preimage resistance as insufficient for 2030+ security horizons.
For most engineers outside Australian government contracts, the practical post-quantum action item for hash functions is using at least 256-bit outputs (making SHA-256 or SHA3-256 both correct choices over SHA-1 or MD5) and monitoring NIST guidance updates. The larger post-quantum urgency is in asymmetric algorithms. See our coverage of NIST’s post-quantum cryptography standards for the full migration timeline for Kyber and Dilithium.
Real-World Use Cases: 5 Deployment Examples
Where SHA-256 and SHA3-256 are actually deployed in production systems tells a clearer story than benchmark numbers or security proofs alone.
Use case 1: Bitcoin and cryptocurrency (SHA-256 locked in). Bitcoin’s proof-of-work algorithm performs double SHA-256 (SHA256d) on block headers. Miners run dedicated ASIC hardware with optimized SHA-256 circuits. The Bitcoin network performs hundreds of exahashes per second, all SHA-256. The network is permanently committed to SHA-256 due to the capital investment in SHA-256 ASICs, making any change a hard fork requiring broad consensus. Litecoin, Bitcoin Cash, and many derivative networks also use SHA-256 for their mining algorithms.
Use case 2: TLS/HTTPS certificates (SHA-256 industry standard). The vast majority of TLS certificates issued by public CAs (Let’s Encrypt, DigiCert, Sectigo) use SHA-256 in their signature algorithms, specifically RSA-SHA256 or ECDSA-SHA256. The CA/Browser Forum Baseline Requirements mandate SHA-256 or stronger for certificate signatures, and browsers validate this. SHA3-256 certificate signatures are technically permitted under NIST standards but almost no CA issues them in production, and client software compatibility is limited. SHA-256 will remain the TLS certificate standard for the foreseeable future.
Use case 3: Package integrity and software distribution (SHA-256 dominant, SHA3-256 growing). Python’s pip verifies packages against SHA-256 hashes stored in PyPI. Cargo (Rust’s package manager) uses SHA-256 for crate verification. npm uses SHA-512 for package integrity. GitHub’s download pages provide SHA-256 checksums for releases. Some newer security tools and integrity frameworks are adopting SHA3-256 for fresh deployments, particularly where the length extension immunity simplifies protocol design. This is the most active migration space where SHA3-256 gains ground organically.
Use case 4: Ethereum smart contracts (SHA3/Keccak-256 native). Ethereum uses a variant of SHA-3 called Keccak-256. This is structurally identical to SHA3-256 but uses a different padding specification (the pre-standardization Keccak padding rather than NIST FIPS 202’s domain separation suffix). Solidity’s built-in keccak256() function is used in every smart contract for event topic signatures, storage slot computation in mappings, and commitment schemes. This makes Keccak-256/SHA3-family hashing native across the entire Ethereum ecosystem, all EVM-compatible L2 chains (Arbitrum, Optimism, Base, Polygon), and Ethereum-adjacent DeFi protocols.
Use case 5: Post-quantum protocol integration (SHA3-256 specified). NIST’s post-quantum standards ML-KEM (FIPS 203, based on CRYSTALS-Kyber) and ML-DSA (FIPS 204, based on CRYSTALS-Dilithium) specify SHA3-256, SHA3-512, SHAKE128, and SHAKE256 as internal hash primitives. If you are implementing post-quantum key exchange or signatures from the NIST PQC standards, you will be implementing SHA-3 as part of the required specification. This creates a natural path for SHA3-256 adoption in security libraries and network protocols adopting post-quantum cryptography.
SHA-256 vs SHA3-256 in Node.js
Node.js’s built-in crypto module supports both algorithms through the same streaming API. The only difference between using SHA-256 and SHA3-256 is the algorithm string passed to createHash().
const crypto = require('crypto');
// SHA-256
const sha256Hash = crypto.createHash('sha256')
.update('hello world')
.digest('hex');
console.log('SHA-256: ', sha256Hash);
// b94d27b9934d3e08a52e52d7da7dabfac484efe04294e576f0b46f7fb8c4a32c (truncated for display)
// SHA3-256
const sha3Hash = crypto.createHash('sha3-256')
.update('hello world')
.digest('hex');
console.log('SHA3-256: ', sha3Hash);
// 644bcc7e564373040999aac89e7622f3ca71fba1d972fd94a31c3bfbf24e3938
Both algorithms accept the same data types: strings, Buffers, TypedArrays, and DataViews. Both support streaming via update() for large files or chunked data. The Node.js crypto module uses OpenSSL under the hood: SHA-256 transparently uses SHA-NI when the CPU supports it, while SHA3-256 uses OpenSSL’s software Keccak implementation.
const crypto = require('crypto');
const fs = require('fs');
// Stream hashing for large files — identical API for both algorithms
async function hashFile(filePath, algorithm) {
return new Promise((resolve, reject) => {
const hash = crypto.createHash(algorithm);
const stream = fs.createReadStream(filePath);
stream.on('data', chunk => hash.update(chunk));
stream.on('end', () => resolve(hash.digest('hex')));
stream.on('error', reject);
});
}
async function compareAlgorithms(filePath) {
const [sha256, sha3] = await Promise.all([
hashFile(filePath, 'sha256'),
hashFile(filePath, 'sha3-256'),
]);
console.log('SHA-256: ', sha256);
console.log('SHA3-256: ', sha3);
}
compareAlgorithms('/path/to/large-file.bin');
To verify SHA3-256 is available in your Node.js version, check crypto.getHashes(). SHA3-256 requires Node.js 12.8.0 or later (OpenSSL 1.1.1 dependency). All Node.js LTS versions (18.x, 20.x, 22.x) include it. If you are running Node.js in a FIPS 140-3 mode environment, verify that your FIPS module explicitly includes SHA-3 support, as some older FIPS modules only included SHA-2.
// Check algorithm availability
console.log('SHA-256 available:', crypto.getHashes().includes('sha256'));
console.log('SHA3-256 available:', crypto.getHashes().includes('sha3-256'));
// HMAC construction — same API for both
const key = Buffer.from('your-secret-key-32-bytes-minimum!', 'utf8');
const message = 'data to authenticate';
const hmacSha256 = crypto.createHmac('sha256', key)
.update(message)
.digest('hex');
// SHA3-256 does not need HMAC for length extension immunity,
// but HMAC-SHA3-256 is valid and works identically if you need keyed hashing
const hmacSha3 = crypto.createHmac('sha3-256', key)
.update(message)
.digest('hex');
// For keyed hashing only: SHA3-256 can be used directly
// (no HMAC needed — sponge construction prevents length extension)
const keyedSha3Direct = crypto.createHash('sha3-256')
.update(key)
.update(message)
.digest('hex');
Benchmarking both in Node.js with perf_hooks will confirm approximately 3-4x throughput difference on any modern server with SHA-NI. To check if SHA-NI is enabled on a Linux server: grep sha_ni /proc/cpuinfo. On servers without SHA-NI (older VMs, pre-2017 hardware), expect 1.5-2x difference rather than 3-4x.
Expert Opinions
Developer consensus on SHA-256 vs SHA3-256 is pragmatic rather than theoretical. The cryptography community universally acknowledges SHA3-256’s structural advantages while simultaneously recommending SHA-256 for the vast majority of existing use cases due to ecosystem compatibility and hardware-accelerated performance.
Sylvain Kerkour (security blogger and Rust developer) writing in his 2024 benchmark analysis updated January 2025: Kerkour argues that SHA-256 remains the right default choice for most applications due to SHA-NI acceleration making it dramatically faster than SHA3-256 on current hardware. He positions SHA3-256 as appropriate for forward-looking designs or where SHA-3 is explicitly required, but is transparent about the 3-4x performance penalty. He also includes BLAKE3 as a serious performance-focused alternative that hits 13,196 MB/s at 1MB on the same Zen 5 hardware, though BLAKE3 is not yet a NIST-approved standard.
Fireship (developer education content creator): Fireship’s cryptography coverage consistently emphasizes practical security over theoretical purity. The recommendation follows the ecosystem: use SHA-256 where the platform specifies it (JWT, TLS, most APIs), and do not overthink it for web application use cases where the hash function is rarely the weakest link in the security chain. SHA3-256’s structural advantages are real but matter most for protocol designers, not everyday application developers implementing standard patterns.
ThePrimeagen (developer and Twitch streamer): In discussions about systems programming and cryptography choices, ThePrimeagen has noted that choosing SHA3-256 over SHA-256 for general application use is premature optimization in reverse: you pay a 3x performance cost for a security benefit (length extension immunity) that HMAC already provides for SHA-256 in any properly designed system. This reflects the broader Rust and systems programming community’s pragmatic take: use the faster, hardware-accelerated tool unless you have a specific protocol design reason to prefer the sponge construction.
Stack Overflow community consensus: The most referenced answer to “what is the difference between SHA-2 and SHA-3” on Stack Overflow states that if you want a secure and standardized hash function, you can choose either SHA-2 or SHA-3, and suggests using both for paranoid designs where the system should remain secure even if one hash function is eventually broken. This dual-hash approach is occasionally practical for long-lived archive integrity but overkill for typical API authentication or file checksums.
NIST CSRC (authoritative guidance): NIST’s current hash functions page explicitly frames SHA-3 as providing “alternatives to the SHA-2 family” rather than replacements. This accurately reflects both the standards status and the practical deployment reality. NIST is not directing developers to migrate from SHA-256 to SHA3-256 for existing systems, which is the most important clarification for engineers facing pressure to “upgrade” from SHA-256 to SHA3-256 without a specific technical reason.
Pricing and Implementation Cost Comparison
Both SHA-256 and SHA3-256 are royalty-free public standards with zero licensing cost. The practical “price” difference is compute cost, migration effort, and ecosystem compatibility.
| Cost dimension | SHA-256 | SHA3-256 |
|---|---|---|
| Algorithm license | Free (public standard) | Free (public standard) |
| Relative compute cost | Baseline (1x) | Approximately 3-4x higher |
| OpenSSL support | Hardware path (SHA-NI) | Software only |
| Node.js crypto support | Native, Node.js 0.x+ | Native, Node.js 12.8+ |
| HSM/FIPS 140-3 support | Universal | Varies by HSM vendor and firmware |
| CA/TLS ecosystem support | Universal | Limited |
| Migration effort (from SHA-256) | N/A | Medium (API change + stored hash migration) |
| Interoperability risk | Minimal | Low to medium (verify counterparty support) |
For cloud compute cost modeling, the CPU difference is real at scale. If an application hashes 100 million objects daily and SHA-256 consumes 2% of vCPU capacity, switching to SHA3-256 increases that to roughly 7-8% of vCPU capacity. At AWS c8g instance pricing (Graviton 4), each vCPU-hour costs approximately $0.048. The additional CPU cost of SHA3-256 for a service at 100M hashes/day works out to a fraction of a dollar per day in absolute terms, so cost is rarely the deciding factor. The interoperability and ecosystem costs are usually larger.
When to Use SHA-256 vs SHA3-256: 5 Recommendations
The right algorithm depends on your specific deployment context. Here are five concrete recommendations with rationale that covers the most common engineering decisions.
Recommendation 1: Use SHA-256 for TLS certificates, JWTs, and web API authentication. The ecosystem standardizes on SHA-256 here. JWTs specify HS256 (HMAC-SHA256) and RS256 (RSA-SHA256) as primary algorithms in RFC 7518. TLS certificates use RSA-SHA256 or ECDSA-SHA256 per CA/Browser Forum requirements. Diverging from these conventions forces interoperability workarounds with no security improvement for typical web applications. See our JWT Authentication in Node.js guide for proper implementation patterns.
Recommendation 2: Use SHA-256 for file integrity verification and package checksums. SHA-256 is the lingua franca for software checksums: sha256sum on Linux, Python’s hashlib default, most package repositories (PyPI, apt, yum, brew). Using SHA3-256 here forces users to install additional tools or write custom verification scripts. The security properties are equivalent, so the compatibility cost is not justified.
Recommendation 3: Use SHA3-256 for new closed-system protocol design. If you are building a new protocol from scratch with no interoperability requirements, SHA3-256 simplifies design by eliminating the length extension attack class entirely. You can use SHA3-256 directly for keyed hashing without HMAC wrapping, reducing implementation complexity. This applies to private APIs, internal microservices with controlled clients, and new network protocols where you choose every component. The 3x performance cost is acceptable at the throughput levels most closed systems operate at.
Recommendation 4: Use SHA3-256 (or Keccak-256) for Ethereum and EVM blockchain systems. Ethereum’s Keccak-256 is structurally equivalent to SHA3-256 (different padding, same construction). For blockchain applications, using SHA3-256 on the off-chain side aligns your hashing stack with the on-chain semantics. Be careful about the Keccak-256 vs NIST SHA3-256 padding difference: use a dedicated keccak256 implementation (ethers.js, viem, web3.js) for Ethereum data, and NIST SHA3-256 (Node.js crypto, OpenSSL) for non-Ethereum data.
Recommendation 5: Use neither for password storage. Both SHA-256 and SHA3-256 are general-purpose hash functions optimized for speed. At 2373 MB/s for SHA-256 and 686 MB/s for SHA3-256, modern GPUs can evaluate billions or hundreds of millions of password guesses per second respectively. This is exactly the wrong property for password hashing. Use Argon2id with at least 64 MB memory and 3 iterations, or bcrypt with cost factor 12 or higher. The 3x speed difference between SHA-256 and SHA3-256 is irrelevant and actively harmful for password storage.
Migration Guide: Moving from SHA-256 to SHA3-256
If you have decided to migrate from SHA-256 to SHA3-256 for regulatory compliance, protocol design, or future-proofing, here is a practical approach that avoids downtime and preserves existing data integrity.
Step 1: Audit all SHA-256 usage in your codebase. Use grep to find every hash call: grep -r "sha256\|SHA256\|sha-256\|SHA-256" --include="*.js" --include="*.ts" . Categorize each by purpose: data integrity checksums stored in a database, digital signatures, HMAC authentication tokens, protocol messages, or cached verification values. Each category has a different migration risk profile.
Step 2: Verify counterparty support before migrating any cross-system hash. For hashes that cross a system boundary (database, external API, certificate, protocol counterparty), verify the other side supports SHA3-256. Node.js 12.8+, OpenSSL 1.1.1+, Java JDK 9+, Python 3.6+, and Go 1.16+ all support SHA3-256. Older systems, some embedded devices, and some HSMs may not. Do not change algorithm identifiers in cross-system protocols until both sides are confirmed compatible.
Step 3: Handle stored hash values with a versioned format during transition. If you store SHA-256 hashes in a database (file deduplication, content addressing, integrity records), you cannot retroactively change them without rehashing all original data. Adopt a versioned hash format: sha256:b94d27b9... and sha3-256:644bcc7e.... During the transition window, compute and store both digests. Deprecate SHA-256 records after completing the migration. This avoids a flag-day cutover and allows gradual migration.
Step 4: Update HMAC constructions selectively. HMAC-SHA256 is already safe from length extension attacks. The HMAC construction provides domain separation and key binding regardless of the underlying hash function. If your reason for migrating is purely length extension immunity, you can keep HMAC-SHA256 without any functional security improvement from switching to SHA3-256. Migrate HMAC only if you are standardizing on SHA-3 across the whole system for consistency or regulatory reasons.
Step 5: Update the algorithm string in Node.js. The code change is trivial:
// Before
const hash = crypto.createHash('sha256').update(data).digest('hex');
// After
const hash = crypto.createHash('sha3-256').update(data).digest('hex');
// Confirm availability (should be true on Node.js 12.8+)
console.log('sha3-256 available:', crypto.getHashes().includes('sha3-256'));
Step 6: Update any digital signature algorithms that embed the hash name. If you use RSA or ECDSA signatures, the OpenSSL algorithm identifier includes the hash: RSA-SHA256 becomes RSA-SHA3-256. Coordinate with all systems that verify your signatures, since verifiers must also support RSA-SHA3-256 or ECDSA-SHA3-256. This is the highest-risk migration step because signature verification failures are silent security holes if a fallback to weaker algorithms is permitted.
Step 7: Run performance tests in your environment before committing. The 3-4x throughput reduction is a benchmark result. In your application, hashing likely represents less than 2% of total request processing time, making the migration cost negligible. Profile your specific workload before assuming the performance difference matters. Monitor CPU utilization after rollout.
Pros and Cons Summary
SHA-256 Pros and Cons
Pros: Hardware acceleration via SHA-NI gives 3-4x throughput advantage on all modern CPUs. Universal ecosystem support across TLS, JWT, Bitcoin, S/MIME, package managers, and almost every cryptographic library and hardware security module. Multi-message batch hashing up to 20 Gbps on AVX-512. Extremely well-studied with 25 years of cryptanalysis finding no weaknesses. Default choice in every major protocol that mandates SHA-2 or stronger. No migration risk for existing systems.
Cons: Vulnerable to length extension attacks when used for keyed hashing without HMAC (requires HMAC-SHA256 for keyed use). Designed by the NSA, which creates a theoretical trust concern for adversarial threat models (no backdoor evidence exists, but the concern is legitimate in some contexts). ASD guidance will deprecate SHA-256 beyond 2030 for Australian government systems. Shares the Merkle-Damgard construction lineage with SHA-1 and MD5, both of which are broken, creating algorithm-family association risk if the construction is ever attacked.
SHA3-256 Pros and Cons
Pros: Immune to length extension attacks by construction, simplifying protocol design for keyed hashing without HMAC. Completely different algorithm family from SHA-1/SHA-2 (Keccak, not Merkle-Damgard), providing design diversity and a hedge against any construction-level attack on Merkle-Damgard. Designed through a public open competition with global cryptographic community review over six years. Sponge construction enables extendable output functions (SHAKE128/256) for protocols needing variable-length digests. Required internally by post-quantum NIST standards ML-KEM and ML-DSA, creating a natural adoption path. Native to Ethereum and the EVM ecosystem.
Cons: 3-4x slower than SHA-256 on hardware with SHA-NI (all modern x86 and ARM CPUs), with no dedicated ISA acceleration available on mainstream processors. Less universal ecosystem support than SHA-256, particularly in TLS certificates, JWT, and legacy HSMs. ASD guidance also restricts SHA3-256 to ML-DSA/ML-KEM internal steps for 2030+ general-purpose use (so it is not simply approved as SHA-256’s replacement in that framework). No multi-message batching implementations available. Keccak-256 (Ethereum) vs NIST SHA3-256 padding difference creates confusion and potential bugs when mixing Ethereum and non-Ethereum SHA-3 implementations.
Related Coverage
- SHA-256 Explained: How It Works and Why It Matters
- Cryptographic Hash Functions Explained
- HMAC-SHA256 in Node.js: 10 Steps, 20 Min [2026]
- Node.js Crypto Module: 12 Steps, 30 Min [2026]
- Symmetric vs Asymmetric Encryption: 1000x Speed Gap [2026]
- Post-Quantum Cryptography: 50% of Web Now Safe [2026]
- AES-256 Encryption in Node.js: 12 Steps [2026]
- Argon2 Password Hashing in Node.js: 11 Steps [2026]
- RSA Encryption in Node.js: 11 Steps [2026]
Verdict: SHA-256 vs SHA3-256
For most engineers in 2026, SHA-256 is the right choice for any existing system or any new system that must interoperate with the broader ecosystem. TLS, JWT, Bitcoin, package managers, certificate authorities, and the vast majority of cryptographic protocols mandate or default to SHA-256. The 3.3-4.3x speed advantage from SHA-NI hardware acceleration is real and measurable. HMAC-SHA256 addresses the only practical vulnerability (length extension attacks) without any architectural changes. NIST approves both algorithms with no deprecation pressure for SHA-256 in US or EU frameworks.
SHA3-256 wins in three scenarios that cover a growing share of new development: closed-system protocol designs where the sponge construction’s length extension immunity simplifies implementation; Ethereum and EVM-compatible blockchain applications where Keccak-256 is native; and systems integrating NIST post-quantum standards (ML-KEM, ML-DSA) where SHA-3 is specified as an internal component. It is also the correct choice for engineers building toward a 2030+ security posture under ASD guidance, though that guidance simultaneously restricts SHA-3 to specific approved use cases rather than general replacement of SHA-256.
The speed gap will likely narrow over the next 3-5 years as CPU vendors consider dedicated Keccak instructions (some embedded processors already include SHA-3 hardware units) and as SHA-3 software implementations continue improving. At that point, SHA3-256 becomes easier to recommend for greenfield projects. Until then, the ecosystem inertia around SHA-256 plus hardware acceleration makes it the pragmatic default for the vast majority of use cases, and SHA3-256 the right choice for engineers who can accept the performance trade-off in exchange for structural security properties and algorithm diversity.
Frequently Asked Questions
Is SHA3-256 more secure than SHA-256?
For practical collision and preimage resistance, both algorithms offer equivalent security: 128-bit collision resistance and 256-bit preimage resistance for the same output size. SHA3-256 has a structural advantage against length extension attacks that SHA-256 lacks without HMAC. Neither algorithm has known breaks. SHA3-256 uses a completely different mathematical construction (Keccak sponge vs Merkle-Damgard), which provides algorithm diversity as a hedge against undiscovered structural weaknesses in one design family.
How much slower is SHA3-256 compared to SHA-256?
On AMD Zen 5 with SHA-NI enabled, SHA-256 is approximately 3.3-3.5x faster than SHA3-256 across input sizes from 64 bytes to 1 MB, based on Kerkour’s 2025 benchmark. On AWS Graviton 4, SHA-256 is 3.4-4.3x faster. The gap is largest at small input sizes (64 bytes: 4.3x on Graviton 4) and on hardware with strong SHA-NI support. On older hardware without SHA-NI, the gap is smaller, typically 1.5-2x.
Can SHA3-256 replace SHA-256 in TLS certificates?
Technically yes under NIST standards, but practically no for most public-facing deployments. The CA/Browser Forum and most public CAs issue certificates using SHA-256 signature algorithms (RSA-SHA256, ECDSA-SHA256). Browser and server software universally supports SHA-256 certificate signatures. SHA3-256 certificate signatures have limited implementation support across clients and servers as of 2026. Deploying SHA3-256 certificates in production public TLS is risky due to client compatibility gaps.
What is the difference between SHA3-256 and Keccak-256?
Keccak-256 is the pre-standardization version of the Keccak algorithm used by Ethereum. NIST SHA3-256 (FIPS 202) differs in padding: NIST added a two-bit domain separation suffix (0x06) before the standard padding, while the original Keccak submission uses 0x01 padding. The outputs of SHA3-256 and Keccak-256 are different for the same input. For Ethereum data, use a dedicated keccak256 library (ethers.js, viem, web3.js). For general cryptographic hashing, use Node.js’s native sha3-256.
Should I use SHA3-256 instead of SHA-256 for password hashing?
No. Neither SHA-256 nor SHA3-256 is appropriate for password hashing. Both are fast general-purpose hash functions that enable rapid GPU-based brute-force guessing. Use Argon2id (recommended by OWASP for new systems) with at least 64 MB memory cost and 3 iterations, or bcrypt with cost factor 12 or higher. The SHA-256 vs SHA3-256 comparison is irrelevant for password storage, where slowness and memory-hardness are the required properties.
Does Node.js support SHA3-256 natively?
Yes. Node.js 12.8.0 and later support SHA3-256 through the built-in crypto module via crypto.createHash('sha3-256'). Support requires OpenSSL 1.1.1 or later, which is bundled with all Node.js 12+ versions. All current Node.js LTS versions (18.x, 20.x, 22.x) include full SHA3-256 support. Verify with crypto.getHashes().includes('sha3-256'), which returns true on any modern Node.js installation.
Is SHA-256 quantum-resistant?
Partially. Grover’s algorithm reduces preimage security from 2^256 to approximately 2^128 operations on a quantum computer, leaving 128-bit quantum preimage resistance. The BHT algorithm reduces collision resistance from 2^128 to approximately 2^85 classical-equivalent operations. Both numbers remain computationally infeasible for foreseeable quantum computers. NIST currently approves SHA-256 for post-quantum environments. Australia’s ASD takes a more conservative position and will not approve SHA-256 beyond 2030. SHA3-256 faces the same quantum reductions, so neither algorithm has a quantum advantage over the other for the same output size.
What is BLAKE3 and how does it compare to SHA-256 and SHA3-256?
BLAKE3 is a third-generation cryptographic hash function not yet standardized by NIST, but widely used in performance-critical non-regulated applications. On AMD EPYC 4245P (Zen 5), BLAKE3 achieves 13,196 MB/s at 1 MB input, versus SHA-256 at 2,373 MB/s and SHA3-256 at 686 MB/s, according to Kerkour’s 2025 benchmark. BLAKE3 cannot be used in FIPS 140-3 compliant systems and is not accepted by most regulatory frameworks. It is appropriate for content-addressable storage, deduplication, build systems (Bazel, Buck2), and performance-sensitive checksumming where NIST approval is not required.
External references: NIST Hash Functions (CSRC), Kerkour SHA-2 vs SHA-3 vs BLAKE3 benchmarks (2025), NIST FIPS 202: SHA-3 Standard, Rublon SHA-3 vs SHA-2 vs SHA-1 vs MD5 (2026), GeeksforGeeks SHA-256 and SHA-3 comparison.




