Course contentsShow
← Security
Lesson 209 of 3,0525. Cryptographic Hashing and MACsFree lesson

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

Exploring the SHA-2 family of hash functions, their differences in output size, and appropriate use cases.

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

You'll learn: What the SHA-2 family is and how to choose the right variant for your security needs.

The SHA-2 Family Overview

After MD5 and SHA-1 were broken (as we learned in the previous lesson), cryptographers needed secure alternatives. The SHA-2 family provides four widely-trusted hash functions that remain unbroken today. The numbers in their names (224, 256, 384, 512) represent the output size in bits — the length of the hash digest they produce.

Think of these like different-sized safes: SHA-256 produces a 256-bit "fingerprint," while SHA-512 produces a 512-bit fingerprint. Larger outputs make collisions exponentially harder to find due to the Birthday Paradox we studied earlier.

The Four Variants

  • SHA-224: Produces 224-bit hashes. Least common; used when slightly smaller outputs are acceptable.
  • SHA-256: Produces 256-bit (32-byte) hashes. Most popular for general use — blockchain, certificates, file integrity.
  • SHA-384: Produces 384-bit hashes. Middle ground for high-security applications.
  • SHA-512: Produces 512-bit (64-byte) hashes. Maximum security margin; sometimes faster on 64-bit systems than SHA-256.

Choosing the Right SHA-2 Variant

SHA-256 is the go-to choice for most applications — it balances security, performance, and widespread support. Use it unless you have specific requirements.

SHA-512 makes sense when you need maximum collision resistance or are working on 64-bit hardware where it may actually outperform SHA-256.

SHA-224 and SHA-384 are truncated versions (SHA-384 is actually SHA-512 with a different initialization and truncated output). They're useful when protocols specify exact output sizes.

All four maintain the crucial security properties: preimage resistance, second preimage resistance, and collision resistance with appropriate security margins.

Key Takeaway: The SHA-2 family offers four secure hash functions with different output sizes; SHA-256 is the most common choice, while SHA-512 provides maximum security and may perform better on 64-bit systems.