Safeguard
Security Guides•

SHA-256 or SHA-3: which hash should app developers use?

SHA-256 is a sound default for most apps and SHA-3 a fine alternative. The choice matters less than using a password hash, HMAC or signature when needed.

Safeguard Security Team
3 min read

SHA-256 is a sound default for most application work, and SHA-3 is a standardized alternative when a protocol or requirement calls for it. Neither is the right tool for passwords. The choice between them matters far less than choosing the right construction: a plain hash, an HMAC, a signature, or a password hash.

What each one is

NIST published SHA-3 as FIPS 202 in August 2015. It specifies four hash functions, SHA3-224, SHA3-256, SHA3-384 and SHA3-512, plus two extendable output functions, SHAKE128 and SHAKE256. SHA-256 belongs to the older SHA-2 family, which NIST specifies in FIPS 180-4, the Secure Hash Standard.

SHA-3 was added to the standard set as a second, differently built family, so that a break in one design would not leave everyone without an alternative.

Choosing in practice

NeedUse
Integrity check of a file or artifactSHA-256 or SHA3-256
Message authentication with a shared secretHMAC, with SHA-256 for example
Signatures and certificatesWhat the protocol specifies, usually SHA-256
Password storageA password hash such as Argon2id
Derive several keys from one secretA key derivation function
Variable length outputSHAKE, if you know why you need it

Support is the practical tie breaker. SHA-256 is available almost everywhere, and many protocols name it. The OWASP TLS guidance says certificates should use SHA-256. Pick SHA-3 when a spec, partner, or policy asks for it.

Notes on HMAC

The Python documentation says extendable output functions such as SHAKE-128 and SHAKE-256 cannot be used with HMAC, because HMAC needs a fixed digest size. Use a fixed output hash there.

Things to avoid regardless

  1. MD5 and SHA-1 for any trust decision. CWE-327 lists both as once strong and now breakable, and the SHAttered work showed a real SHA-1 collision.
  2. A bare hash of a secret and a message as a homemade MAC. Use HMAC.
  3. A fast hash for passwords.
  4. Truncating digests without understanding what you lose.
  5. Hash comparisons with ==, when the value is a secret or MAC.

Record the algorithm

Store the algorithm name with each digest, for example sha256:value. If you later need SHA3-256 or something else, old records still say what they are. That small habit is crypto agility in practice, which CWE-327 recommends.

A tiny decision rule

If you are writing new code and nothing forces a choice, use SHA-256. If a standard or customer names SHA-3, use it. If you are hashing a password, stop and use a password hash.

Related reading

See are MD5 and SHA-1 still safe for checksums, and hash, MAC, signature or encryption for choosing the right construction.

Safeguard can generate an SBOM and scan your dependencies, so outdated cryptography libraries with known advisories show up in one inventory, and policies can gate a build on them. A free scan is at gold.safeguard.sh/scan.

Quick check

Is SHA-3 more secure than SHA-256?

They are different designs. Neither has a practical break cited in the sources used here, so security alone is rarely a reason to switch. Follow requirements and library support.

Can I use SHA-3 for passwords?

No. It is still a fast general hash. Use a password hashing algorithm.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.