Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
SHA-2 and SHA-3 are the two NIST-approved families of cryptographic hash functions. Despite the numbering, SHA-3 is not a replacement for SHA-2 but a structurally different backup.

What Are SHA-2 and SHA-3?
SHA-2 and SHA-3 are the two families of cryptographic hash functions approved by NIST. The numbering suggests a succession, which is the single most common misunderstanding about them: SHA-3 was never designed to replace SHA-2. It exists because SHA-1 and SHA-2 share an internal construction, and a breakthrough against one might have taken the other with it. SHA-3 is the insurance policy, built on completely different mathematics.
Published by NIST in 2001 and now specified in FIPS 180-4, SHA-2 is a set of six functions: SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224, and SHA-512/256. They use the Merkle-Damgård construction, processing the message in fixed blocks through a compression function that updates an internal state. SHA-256 and SHA-512 differ in word size (32-bit versus 64-bit), which is why SHA-512 is often faster on modern 64-bit CPUs despite producing a longer digest.
Twenty-four years of analysis has produced no practical attack. The best published collision results reach only 31 of SHA-256’s 64 rounds. SHA-2 is also the family with hardware behind it: Intel SHA extensions and the ARMv8 cryptographic extensions implement SHA-256 directly in silicon, so it is frequently the fastest option available.
Xiaoyun Wang’s results against MD5 in 2004 and SHA-1 in 2005 made the Merkle-Damgård design look fragile. NIST opened a public competition in 2007, received 64 submissions, and narrowed them over five years. Keccak, designed by Guido Bertoni, Joan Daemen, Michaël Peeters, and Gilles Van Assche, won in October 2012 and was standardised as FIPS 202 in August 2015. Joan Daemen had already co-designed Rijndael, which became AES—an unusual double.
SHA-3 uses a sponge: the message is absorbed into a 1,600-bit state a block at a time, then output is squeezed out of the same state. Because only part of the state is ever exposed, SHA-3 is immune to length extension, the quirk that lets an attacker who knows hash(secret || message) compute hash(secret || message || suffix) without knowing the secret. With SHA-2 you avoid that by using HMAC; with SHA-3 you can key the hash directly, which is what KMAC in NIST SP 800-185 does.
| SHA-2 | SHA-3 | |
|---|---|---|
| Construction | Merkle-Damgård | Keccak sponge |
| Standard | FIPS 180-4 (2001) | FIPS 202 (2015) |
| Length extension | Affected (SHA-224 and SHA-512/256 excepted) | Not affected |
| Software speed | Faster, especially with CPU instructions | Slower in software, efficient in hardware |
| Variable-length output | No | Yes, via SHAKE128 and SHAKE256 |
For general integrity, signatures, and certificates, SHA-256 remains the sensible default and will stay approved for the foreseeable future. Choose SHA-384 where a policy requires it—the NSA’s CNSA 2.0 suite, for example, specifies SHA-384 or SHA-512 for national security systems. Reach for SHA-3 when you need a keyed hash without HMAC, when you need an extendable-output function to derive arbitrary-length key material, or when you deliberately want algorithm diversity in a design that must survive a surprise. Neither family needs replacing for quantum reasons: Grover’s algorithm halves preimage resistance, leaving SHA-256 with 128 bits there, and quantum collision search buys an attacker almost nothing over the classical birthday bound. The post-quantum signature standards lean on both families, ML-DSA on SHAKE and SLH-DSA in parameter sets built on either SHA-2 or SHAKE.
If an inventory shows SHA-1 or MD5 still signing anything in your environment, that is the migration to fund first—our Regulation and Compliance Services can map where those algorithms remain in scope.
Not in any measurable way today. Both resist all known practical attacks, and SHA-256 has had far more real-world scrutiny. SHA-3’s advantage is structural independence: it would survive a break in the Merkle-Damgård design that affected SHA-2. Think of it as diversification rather than an upgrade, which is exactly how NIST presents the two families.
Neither on its own. Both are designed to be fast, which is the opposite of what password storage needs. Use a purpose-built key derivation function such as Argon2id, scrypt, or bcrypt, each of which applies a salt and deliberate cost. PBKDF2 uses SHA-256 internally, but only with a high iteration count that makes guessing expensive.
They are extendable-output functions defined in FIPS 202 alongside SHA-3. Rather than producing a fixed digest, they can emit as many bytes as you ask for, which is useful for deriving key material, generating masks, and filling buffers inside signature schemes. The numbers refer to the security level in bits, not the output length, which trips people up.
No. NIST has given no end date for SHA-256, and it is the algorithm underpinning current certificates, package signing, and the new post-quantum standards. Spend the effort instead on removing SHA-1 and MD5, which still linger in legacy signature chains, old file integrity checks, and internal public key infrastructure that nobody has reviewed for a decade.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.