MD5, SHA-256, SHA-3, BLAKE3 and CRC32: Choosing the Right Hash

Checksums, fingerprints and integrity checks all use hashes, but not the same ones. What SHA-2, SHA-3, Keccak, BLAKE3 and CRCs are good for, and which to retire.

By · · Updated · 9 min read

Illustration for the Hash Generator guide

A hash function takes input of any size and produces a fixed-size output, the digest, that looks completely unrelated if even one bit of the input changes (about half of its bits flip). That simple property powers file integrity checks, Git commit IDs, digital signatures, cache keys and deduplication.

But "hash" covers very different algorithms, and picking the wrong one is a common mistake, either using something broken for security or something slow and heavy where a simple checksum would do. This guide covers the algorithms in the Hash Generator and when to use each.

What makes a good hash

A cryptographic hash function is expected to have three properties:

Avalanche effect: the inputs hello and Hello differ in one bit of the first byte, yet their SHA-256 digests share no visible pattern
Avalanche effect: the inputs hello and Hello differ in one bit of the first byte, yet their SHA-256 digests share no visible pattern
  • Pre-image resistance. Given a digest, you cannot find an input that produces it.
  • Second pre-image resistance. Given an input, you cannot find a different input with the same digest.
  • Collision resistance. You cannot find any two inputs with the same digest.

Collision resistance is the first to fall as an algorithm ages, and it is the one that matters for signatures and certificates.

Hashes also show the avalanche effect. Hash hello and Hello with SHA-256 and the two digests share nothing recognizable. Try it in the tool: change one character and watch the whole output change.

The algorithms

AlgorithmOutputPublishedStatus
CRC3232 bits1960s–70sError detection only, not cryptographic
MD5128 bits1992Broken for security; fine as a checksum
SHA-1160 bits1995Broken for security; being phased out
SHA-256256 bits2001Current standard
SHA-384384 bits2001Truncated SHA-512 variant
SHA-512512 bits2001Current standard, faster on 64-bit CPUs
SHA-3 (224 to 512)224 to 512 bits2015Current standard, different design from SHA-2
BLAKE2b / BLAKE2s512 / 256 bits2012Secure, fast in software
BLAKE3256 bits2020Secure, very fast, parallel
CRC32C, Adler-32, xxHash32 to 64 bits1993 to 2019Checksums only, not cryptographic

CRC32

A cyclic redundancy check is not a cryptographic hash at all. CRCs were designed to detect accidental errors in transmission and storage, and they are very good at it, catching all burst errors up to 32 bits. You find CRC32 in ZIP archives, PNG image chunks, gzip and Ethernet frames.

What CRC32 cannot do is resist a deliberate attacker. It is linear, so it is easy to modify data and fix up the CRC to match. Use it to catch corruption, never to detect tampering.

MD5

Ron Rivest published MD5 in 1992 (RFC 1321). By 2004 researchers led by Xiaoyun Wang demonstrated practical collisions, and in 2008 a team used MD5 collisions to create a rogue certificate authority certificate. In 2012 the Flame malware used an MD5 collision to forge a Microsoft code-signing certificate.

MD5 is still everywhere for non-security purposes: checking downloads against accidental corruption, cache keys, deduplicating files, ETags. Those uses are fine, because no adversary is crafting colliding inputs. Anything involving trust, such as signatures, certificates or verifying software from an untrusted mirror, needs SHA-256.

SHA-1

SHA-1 was designed by the NSA and published by NIST in 1995. Theoretical weaknesses appeared in 2005. In 2017, Google and CWI Amsterdam announced SHAttered, two different PDF files with the same SHA-1 hash. Browsers had already stopped trusting SHA-1 TLS certificates by then.

Git historically identified objects with SHA-1, and responded to SHAttered by adding collision detection, and later support for SHA-256 repositories. NIST has announced that SHA-1 should be phased out completely by 2030.

SHA-2: SHA-256, SHA-384, SHA-512

The SHA-2 family, published in 2001 and specified in FIPS 180-4, is the current workhorse. SHA-256 secures TLS certificates, Bitcoin's proof of work, code signing, Subresource Integrity in HTML and countless file checksums.

A useful performance fact: SHA-512 works on 64-bit words and is often faster than SHA-256 on 64-bit CPUs without hardware SHA extensions. SHA-384 is SHA-512 with different initial values and a truncated output.

In the RedBison tool, SHA-2 text hashes are computed with the browser's Web Crypto API (crypto.subtle.digest), the same native implementation browsers use for their own cryptography. Files, and every algorithm below, go through hash-wasm, a WebAssembly library checked against the published test vectors.

SHA-3 and Keccak-256

NIST ran an open competition from 2007 to 2012 for a backup to SHA-2 that did not share its Merkle-Damgård structure. Keccak won, and FIPS 202 (2015) standardised it as SHA3-224, SHA3-256, SHA3-384 and SHA3-512. SHA-3 uses a "sponge": input is absorbed into a 1600-bit state and output is squeezed out, which also makes it immune to the length-extension attacks that affect SHA-256.

During standardisation NIST changed the padding byte. Ethereum had already adopted the original submission, so Ethereum's "SHA3" is actually Keccak-256, and it produces a completely different digest from SHA3-256 for the same input. The empty string, for example, gives c5d24601... under Keccak-256 and a7ffc6f8... under SHA3-256. If you are computing Solidity function selectors or Ethereum addresses, choose Keccak-256.

BLAKE2 and BLAKE3

BLAKE was a SHA-3 finalist. Its successor BLAKE2 (RFC 7693) comes in BLAKE2b for 64-bit machines and BLAKE2s for 32-bit and embedded ones, and is used by Argon2, WireGuard and many package managers. BLAKE3 (2020) reorganised it as a Merkle tree, so long inputs can be hashed on many cores at once; in software it is several times faster than SHA-256. Both are considered secure. Choose SHA-256 when you need to match checksums someone else publishes, and BLAKE3 when you control both ends.

Whirlpool, SM3, RIPEMD-160 and MD4

Whirlpool (2000) is a 512-bit hash standardised in ISO/IEC 10118-3 and seen in some disk-encryption and archiving tools. SM3 is China's national standard hash (GB/T 32905-2016), required in Chinese commercial cryptography alongside SM2 and SM4. RIPEMD-160 survives mainly in Bitcoin, where addresses are RIPEMD-160 of SHA-256. MD4 is thoroughly broken and only appears in legacy places like Windows NTLM password hashes and eDonkey file links.

Checksums: CRC32C, Adler-32 and xxHash

CRC32C uses the Castagnoli polynomial, which detects errors better than classic CRC32 and has a dedicated instruction on modern x86 and ARM CPUs; iSCSI, SCTP, ext4 and Btrfs use it. Adler-32 is the checksum inside zlib streams: faster than CRC32 but weaker on short inputs. xxHash64 and XXH3 are extremely fast non-cryptographic hashes used for deduplication, caching and file sync. Like CRC32, none of them resists deliberate tampering.

Some older hash pages also list Tiger, Snefru, GOST R 34.11-94 and HAVAL. None has a maintained browser implementation and none is recommended today, so the tool leaves them out.

Choosing an algorithm

  • Integrity against attackers (signatures, release checksums, content addressing): SHA-256, SHA-512, SHA-3 or BLAKE3.
  • Detecting accidental corruption in storage or transfer: CRC32, CRC32C, xxHash or MD5 are fine and fast.
  • Matching a specific ecosystem: Keccak-256 for Ethereum, SM3 where Chinese standards apply, RIPEMD-160 for Bitcoin address work.
  • Cache keys and deduplication: MD5 or SHA-256; collisions are not a realistic concern for random data.
  • Storing passwords: none of the above.

Why plain hashes are wrong for passwords

This deserves its own section because it is still a common mistake. SHA-256 is designed to be fast; a modern GPU can compute billions of SHA-256 hashes per second. If an attacker steals a table of unsalted SHA-256 password hashes, they can try every common password against every hash very quickly, or look them up in precomputed tables.

Password storage needs a function that is deliberately slow and salted: bcrypt, scrypt or Argon2. The Bcrypt Hash Generator and the bcrypt guide cover that in detail.

Why your hash does not match

You compute a SHA-256 and it differs from the one on the download page. The algorithm is almost never wrong; the input is. Hash functions operate on bytes, so anything that changes the bytes changes the hash:

  • A trailing newline. echo "hello" | sha256sum hashes hello\n. Use echo -n.
  • Line endings: Windows CRLF versus Unix LF.
  • Text encoding: UTF-8 versus UTF-16, or a byte order mark.
  • Leading or trailing spaces copied from a web page.
  • Hex case: AB12 and ab12 are the same digest written differently.

On the command line, sha256sum file (Linux), shasum -a 256 file (macOS) and Get-FileHash file (PowerShell) are the usual tools for files. The Hash Generator's File tab does the same in the browser: it reads the file in 4 MB slices, can compute every algorithm in one pass, and compares the result with a checksum you paste in.

HMAC: hashes with a key

If you need to prove a message came from someone holding a secret, a plain hash is not enough, because anyone can compute it. HMAC (RFC 2104) combines a hash with a secret key. Webhook signatures from Stripe, GitHub and Slack are HMAC-SHA256 values your server recomputes and compares. Compare them with a constant-time function to avoid timing attacks.

Related tools

Frequently asked questions

What is the avalanche effect in hashing?

The avalanche effect means that changing even one bit of a hash function's input flips about half the bits of its output, so the new digest looks completely unrelated. Hashing hello and Hello with SHA-256, which differ in one bit of the first byte, gives two digests that share nothing recognizable.

What are the three properties of a cryptographic hash function?

A cryptographic hash function should have pre-image resistance, so you cannot find an input from its digest; second pre-image resistance, so you cannot find a different input with the same digest as a given one; and collision resistance, so you cannot find any two inputs with the same digest. Collision resistance is the first to fall as an algorithm ages.

Is CRC32 a cryptographic hash?

No. CRC32 is a cyclic redundancy check designed to detect accidental errors in transmission and storage, and it catches all burst errors up to 32 bits. It is used in ZIP archives, PNG chunks, gzip and Ethernet frames. Because CRC32 is linear, an attacker can modify data and fix up the CRC to match, so it cannot detect tampering.

How do I get the SHA-256 hash of a file?

On the command line, use sha256sum file on Linux, shasum -a 256 file on macOS or Get-FileHash file in PowerShell. The Hash Generator File tab does the same in the browser, reading the file in 4 MB slices, and can compare the result with a checksum you paste in.

Which hash algorithms does Bitcoin use?

Bitcoin uses SHA-256 for its proof of work, and its addresses are RIPEMD-160 of SHA-256. RIPEMD-160 survives today mainly in that role. Ethereum is different: its "SHA3" is actually Keccak-256, the original Keccak submission, which produces a different digest from the FIPS 202 SHA3-256 for the same input.

Sources and further reading

Open the Hash Generator

More Security Tools

Every tool in the Security Tools section, free and in your browser.