← Back to section · Foundations of Cryptography
Anatomy of the SHA-2 Family: Two Machines Behind Four Names
SHA-224, SHA-256, SHA-384 and SHA-512 look like four algorithms but are really two machines: a 32-bit-word SHA-256 and a 64-bit-word SHA-512, with the other members derived by changing initial values and truncating output. Understanding this family tree resolves half of all deployment selection questions.
Your config file says SHA-256, a certificate says SHA-384, and some older device only supports SHA-512. These names look like four independent algorithms, but open FIPS 180-4 and the SHA-2 family turns out to contain only two machines. Sorting out this family tree dissolves many deployment puzzles on its own — why SHA-512 can be faster than SHA-256 on a 64-bit server, and why SHA-384 does not fear length extension.
Two cores: 32-bit and 64-bit
The family’s elder is SHA-256: an internal state of eight 32-bit words, messages processed in 512-bit blocks, and a compression function running 64 rounds. SHA-512 is the same design scaled up: eight 64-bit words, 1024-bit blocks, 80 rounds. On a 64-bit processor, each SHA-512 round runs in native word size and fewer rounds are spent per byte, so its throughput often beats SHA-256; on 32-bit embedded platforms, where 64-bit operations must be stitched from several instructions, SHA-256 wins. That is why “which is faster?” has no universal answer — the answer lives in the hardware.
The remaining members are derivatives. SHA-224 is SHA-256 with a different set of initial constants, outputting only 224 bits; SHA-384 is likewise SHA-512 with changed initial values and 384 bits of output. Changing the initial value looks redundant but is essential: it makes the members’ outputs independent — a SHA-384 result is not the first 384 bits of a SHA-512 result; they are separate functions.
A shared design language
Both cores’ compression functions speak the same language. Each round begins with message expansion, stretching the 16 original data words into the full sequence of words the rounds need (new words mixed from earlier ones by linear combinations and shifts); then the round function updates the state with two core logical pieces: Ch (the choose function — each bit of a state word selects which of two candidate words contributes its bit) and Maj (the majority function), together with Σ functions made of rotations and shifts, and a set of round constants. Those constants are not picked at random: SHA-256’s initial values come from the fractional parts of the square roots of the first eight primes, and its round constants from the fractional parts of the cube roots of the first 64 primes — “nothing-up-my-sleeve numbers” signalling that the designer hid no back door. The overall skeleton is still Merkle–Damgård: block-by-block iteration with the final state as the output — which means the original four members are equally exposed to length extension, unless, like SHA-384, they truncate.
What one compression round actually computes
Zoom into one round of SHA-256: the state holds eight working variables, and each round’s message expansion supplies that round’s word , injected together with the round constant . The Ch function lets one state word choose, bit by bit, between two candidates — every bit of the data takes part in a small “vote on direction”; the Maj function takes a bitwise majority of three state words, providing stability and mixing; and the two Σ functions rotate a state word by different amounts and XOR the results, spreading each bit’s influence across the full word width. At the end of the round the working variables shift over: the oldest is pushed out and a new combination enters. After 64 rounds, the eight state words are added, word by word, to the incoming chaining value (this step is the feed-forward) to produce the next block’s chaining value. The feed-forward looks minor but is a key part of what makes the compression function one-way: without it, inverting from output to input would become far easier. This language of “logic gates + rotations + modular addition” contains no multiplications and no lookups, is short to write down, and yet ensures that any changed input bit diffuses across the whole state within a few rounds — that is how the avalanche effect is forged.
Hardware and deployment: why it is everywhere
SHA-2’s other success happened off the design track: it was written into hardware. Mainstream x86 and ARM processors carry dedicated instructions for SHA-256 (and in the SHA-512 direction), pressing the per-byte computation cost extremely low; TLS libraries, disk encryption, package managers and version control systems all ship it by default. The result is that SHA-2 is not merely an algorithm in a standard’s text but an established fact of the entire digital infrastructure. This carries a migration corollary: whatever the future migration — to SHA-3, or to hashes paired with post-quantum signatures — SHA-2’s installed base will be one of the largest sources of inertia, and inventorying where it appears in your own systems is a serious piece of engineering in its own right, one this site’s migration section returns to repeatedly.
The slash members: born to close a gap
Two later additions carry slashes in their names: SHA-512/224 and SHA-512/256, both built from the 64-bit core with dedicated initial values and truncated output. They answer two practical needs. First, truncation keeps the full internal state out of the attacker’s hands, so length extension fails — a structural patch achieved purely through output handling, with no change of algorithm. Second, SHA-512/256 lets 64-bit platforms deliver 256-bit output at SHA-512 speed while keeping 256-bit-class collision expectations, a pragmatic option for performance-sensitive server workloads.
A common misunderstanding: is longer output always safer?
One more misreading of the family tree deserves clearing up: many assume SHA-512 must be “twice as safe” as SHA-256 because the bit count doubles. In reality, the attack surfaces they face do not scale by that ratio. Collision security does scale by the birthday bound with output size (roughly 128 bits versus 256 bits for 256-bit and 512-bit outputs), but 128 bits of collision security already lies far beyond any attacker’s budget under foreseeable computing technology — going from “cannot be attacked” to “cannot be attacked even harder” has limited engineering meaning. The real differences lie elsewhere: first, the platform throughput discussed above; second, identical exposure to length extension (both originals output their full state, with SHA-384’s truncation the exception); third, ecosystem support, since some protocols and hardware recognize only specific members of the list. The right selection question is not “which has more bits?” but “which runs faster on my platform, which do my interoperability partners accept, and do I need the structural benefit of truncation?”. Bit-count worship in cryptographic selection is usually a sign of laziness.
Selection, in short
Translated into deployment language: default to SHA-256 for general use; on 64-bit servers chasing throughput, consider SHA-512 or SHA-512/256; when built-in length-extension resistance or longer output is wanted, use the SHA-384/SHA-512 line; and there is no reason to pick SHA-224-class output lengths for new systems today. Whichever you choose, remember they all belong to one design lineage — which is exactly why NIST standardized SHA-3 as independent insurance (covered in a companion article in this section).
Tags: SHA-2SHA-256SHA-512