SHA-3, BLAKE2 and BLAKE3

How a sponge construction differs from Merkle-Damgard, where SHA-3 fits alongside SHA-2, the BLAKE2 variants and their speed, and what BLAKE3 adds with tree hashing.

Two constructions, three families

AlgorithmConstructionSpeedNotable property
SHA-256 / SHA-512Merkle-DamgardModerate, widely acceleratedUbiquitous; not extension resistant
SHA-3 (Keccak)SpongeSlower in software than SHA-2Different structure, so SHA-2 breaks do not transfer
SHAKE128/256Sponge, extendable outputSimilar to SHA-3Variable-length output from one primitive
BLAKE2b / BLAKE2sHAIFA-style, ChaCha coreFaster than SHA-256 in softwareBuilt-in keying and salt
BLAKE3Merkle tree over a BLAKE2s-like coreVery fast, parallel and SIMDOne primitive for hashing, keying, KDF and XOF
# SHA-3 and SHAKE from the command line
printf 'hello' | openssl dgst -sha3-256
printf 'hello' | openssl dgst -shake256 -xoflen 64

# BLAKE2 ships with many standard tools
printf 'hello' | b2sum -l 256
printf 'hello' | openssl dgst -blake2b512

One primitive, several modes

import hashlib

# SHA-3 family
hashlib.sha3_256(b"hello").hexdigest()
hashlib.shake_256(b"hello").hexdigest(32)          # 32 bytes of output, your choice of length

# BLAKE2 with native keying, salt and personalisation
key = b"0123456789abcdef"
mac = hashlib.blake2b(b"message", key=key, digest_size=32)
mac.hexdigest()

# BLAKE2 can act as a KDF via the person and salt parameters
hashlib.blake2b(b"context", digest_size=32,
                salt=b"saltsaltsaltsalt",
                person=b"app-v1          ").hexdigest()
  • The sponge construction absorbs the input and then squeezes output, which is why one algorithm can produce any output length.
  • SHAKE is an extendable-output function: useful for deriving keys, not just for a fixed digest.
  • BLAKE2b is faster than SHA-256 on 64-bit CPUs without hardware acceleration, and about as fast with it.
  • Keyed BLAKE2 is a genuine MAC and does not suffer length extension, so it can replace HMAC when both ends support it.

BLAKE3 and tree hashing

BLAKE3 splits the input into chunks, hashes them in parallel and combines them with a Merkle tree. That makes it the fastest mainstream hash on large inputs and gives it verification properties for free.

import blake3

h = blake3.blake3(b"hello")
print(h.hexdigest())

# extendable output, like SHAKE
print(h.digest(length=64).hex())

# keyed mode, a real MAC
mac = blake3.blake3(b"message", key=b"0" * 32).hexdigest()

# derive a subkey, changing the domain without changing the key
sub = blake3.blake3(b"context", derive_key_context="session token v1").hexdigest()[:32]
TaskRecommendedWhy
File integrity at scaleBLAKE3 or SHA-256BLAKE3 is far faster; SHA-256 is universally available
MAC for a protocolHMAC-SHA256Every platform implements it
MAC in a performance pathKeyed BLAKE2 or BLAKE3One pass, faster than HMAC
Long-lived signaturesSHA-256 or SHA-512Standardised and well analysed
Deriving keysHKDF-SHA256 or BLAKE3 derive_keyPurpose-built, domain separated
Post-quantum-conscious choiceSHA-3 or SHAKEDifferent structure from SHA-2
💡
A newer hash is not automatically a safer one. SHA-3 has been standardised since 2015 and is well analysed; a brand-new algorithm with a smaller review history is a different kind of risk. Prefer standardised options unless speed is the deciding constraint.

FAQ

Should I use SHA-3 instead of SHA-256?
Only if you need a different construction, extendable output, or an organisational policy requires it. SHA-256 remains secure and is much better supported and hardware accelerated.
Is BLAKE3 safe for signatures?
It is well designed and becoming standardised, but signing ecosystems are conservative. Use SHA-256 or SHA-512 for signatures and keep BLAKE3 for high-throughput integrity work.

Collisions, birthday attacks and length extension Choosing a hash: a decision guide

Last refreshed 2026-09-18.