Feedforward in SHA-256 compression 2026-11-05
Feedforward in SHA-256 compression adds the incoming chaining state to the final working words after the 64 rounds of a message block. The addition is componentwise modulo . It is a specified part of the hash compression function, separate from the round updates.[ref]
Secure Hash Standard by National Institute of Standards and Technology. §6.2.2, initialization, rounds and step 4
Write for the incoming state. Initialize the working words from that state, execute all 64 rounds with the block's message schedule, then formThe right-hand working words are their values after the rounds. These eight sums become the input state for the next block, or contribute to the final digest when the padded message is complete.[ref]
For an original single-word arithmetic example, suppose an incoming word is hexadecimal
fffffff0 and its final working word is 00000030. Their ordinary sum is 100000020; reducing modulo retains 00000020. The carry beyond the 32-bit word is discarded. This example illustrates the addition rule, not an actual round output for a chosen message.Returning only the working words omits feedforward and computes a different function. Using the fixed initial constants after every block also changes the function: after the first block, feedforward uses the immediately incoming chaining state. Compliance with these operations is a correctness requirement; the existence of feedforward alone is not a proof of collision resistance.
Hash compression function 2026-11-05
A hash compression function combines a fixed-size chaining state and one fixed-size message block to produce the next chaining state. For state width and block width , a common interface isA complete iterative cryptographic hash function additionally specifies its hash initialization vector, message padding, block order and output rule. For SHA-256, the state has256bits and a block has512bits; the standard defines a64-word message schedule,64rounds and the additions producing the next eight-word state.[ref]
Here compression is not reversible file compression. The function maps input pairs into only states. Averaged over output states, each state has preimages, counting zero-preimage states too. Collision resistance concerns the difficulty of finding suitable collisions, not their mathematical absence.
An original deliberately weak example makes the interface concrete. Let the state be one byte and the block be two bytes, and defineStarting from hexadecimal
6a, block 00 01 gives 6b; a following 00 02 gives 6d. But 01 00 also gives 6b from the same initial state. The interface and shrinking state size alone have supplied no cryptographic security. This toy is not an approximation to the SHA-256 round function.The standard's feedforward in SHA-256 compression adds the incoming state words to the final working words modulo . Omitting that step changes the compression function even if all64rounds were otherwise correct.[ref]
Secure Hash Standard by National Institute of Standards and Technology. §6.2.2, step4, intermediate hash value
A completed message digest also includes the effect of padding and is not generally the state after an unpadded payload fragment. Hash initialization vector 2026-11-05
A hash initialization vector is the initial internal state from which a specified cryptographic hash function begins processing a message. For the SHA-2 algorithms, it is a public, algorithm-defined sequence of state words. It is not a fresh per-message cryptographic nonce, a secret key or a cryptographic salt.[ref]
Secure Hash Standard by National Institute of Standards and Technology. §5.3, setting the initial hash value
For an iterative hash, write the state update schematically aswhere is one padded message block and is the algorithm's hash compression function. The digest is derived from the final state by the algorithm's output rule. Initial state, padding, compression and output rule together specify the function; agreeing on only the output width does not specify a hash.
An original comparison uses two specified algorithms. SHA-256 starts with the 32-bit word
6a09e667, while SHA-224 starts with c1059ed8. Both subsequently use the SHA-256-family compression structure, but their full initial states differ. Even the empty message is padded and processed, so its digest is not simply a printed initial state.[ref]Computing the empty-message digests gives SHA-256
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855and SHA-224
d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f.Keeping the first 28 bytes of the first result does not produce the second. Initialization acts before every subsequent block transformation; final truncation cannot substitute for it.
This also matters when implementing several hash variants with one compression routine. Resetting a context must restore the chosen variant's complete initial state and length counters. Accidentally reusing a previous message's final state computes a different function. A known-answer test for empty and short messages can expose such state-management mistakes, although passing finitely many vectors does not prove every update sequence correct.
Incremental hashing of a cryptographic transcript supplies successive encoded message bytes to one continuing cryptographic hash function state. Finalizing after the selected messages gives the same transcript hash as hashing their full concatenation in one call. TLS explicitly permits implementing the handshake computation using a running hash.[ref]
The Transport Layer Security Protocol Version 1.3 (RFC 8446). §4.4.1, transcript encoding; §4.4.4, running handshake hash
For an original SHA-256 example, updating with ASCII
ab and then c gives the same result as one update with abc:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.A chunk boundary is an input-delivery detail. It does not insert a separator byte or end a message. A continuing implementation must preserve the processed bit count and any incomplete block as well as its chaining state; final padding encodes the complete input length. SHA-256's specification processes 512-bit blocks and pads the complete message before its final compression operations.[ref]
In particular, and specify different inputs. The latter inserts a completed digest, with its already finalized hashing boundary, where the original bytes belonged. It is not an incremental implementation of the former.
The protocol must still define which bytes enter the state. TLS includes handshake headers in the transcript hash and specifies a special first-message substitution after a retry. A running hash implements that prescribed input, rather than defining the transcript by itself.[ref] An unkeyed digest also supplies no sender authentication by itself; the protocol must bind it through its specified digital signature or message authentication code.
SHA-2 2026-11-05
SHA-2 is a family of cryptographic hash functions including SHA-224, SHA-256, SHA-384, SHA-512, SHA-512/224 and SHA-512/256. NIST specifies these algorithms in FIPS 180-4. Their digest lengths are respectively 224, 256, 384, 512, 224 and 256 bits; the algorithm name therefore matters as well as the output size.[ref]
The SHA-224/SHA-256 branch uses 32-bit words and 512-bit message blocks. The SHA-384/SHA-512 branch and its specified truncation variants use 64-bit words and 1024-bit message blocks. Different initial values are part of the definitions. In particular, SHA-512/256 is not simply the first 256 bits of an ordinary SHA-512 digest.[ref]
53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23.ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a.Both outputs occupy 32 bytes and require 64 hexadecimal digits, yet they differ. An interface identifying its hash only as a 256-bit digest leaves the selected algorithm ambiguous.
A digest is deterministic and does not conceal low-entropy inputs by itself. Nor does an unkeyed digest establish who supplied a message: a sender-authentication mechanism such as HMAC uses a cryptographic key and an appropriate security definition. Preimage resistance, second-preimage resistance and collision resistance are distinct properties; their meanings should not be replaced by the mere observation that two displayed examples have different outputs.
SHA-224 2026-11-05
SHA-224 is a SHA-2 cryptographic hash function producing a 224-bit digest. It follows the SHA-256 computation with a different hash initialization vector and a final output shortened to its first seven 32-bit state words.[ref]
If the final state words are , the digest isThis is bits, or 28 bytes and 56 hexadecimal digits. The input is still padded into 512-bit blocks, and each block still undergoes the SHA-256 family's 64-round computation. Output width and internal processing width are different quantities.
23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7.A SHA-256 digest of the same bytes begins
ba7816bf8f01cfea. Keeping only its first 28 bytes therefore does not give SHA-224. The algorithm's different initial values are applied before processing any message block.The same output length also does not make SHA-224 identical to SHA-512/224. The latter uses the 64-bit SHA-512 family structure, a different initial state and a different padding/length-field convention. For instance, a 56-byte input takes two padded blocks in SHA-224 but only one in the SHA-512-based variant. Both results have 28 bytes, so a digest field's size cannot identify which function produced it.
The intended cryptographic protocol must select the hash explicitly. A cryptographic test vector for SHA-224 checks that defined function, whereas an HMAC vector also specifies its key and keyed construction.
SHA-256 2026-11-05
SHA-256 is a SHA-2 cryptographic hash function producing a 256-bit digest. It processes a padded message in 512-bit blocks, with eight 32-bit state words and 64 processing rounds per block. The specified additions use modular arithmetic modulo .[ref]
Padding is part of the function. For input bit length , append a one bit, then the smallest nonnegative number of zero bits satisfyingthen append the 64-bit representation of . This makes the complete length a multiple of 512 bits.[ref]
For an original byte-count example, the three ASCII bytes
61 62 63 have length 24 bits. Here , andThe padded block consists of the original three bytes, byte 80, 52 zero bytes and an eight-byte length field representing 24. The padded input occupies 64 bytes; the final digest occupies 32 bytes. Computing SHA-256 givesba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad.Adding a newline changes the byte sequence and the digest. Displayed text, its character encoding and its line terminator must therefore be specified when comparing hash values.
The padding boundary is also visible without computing a digest. A 55-byte input fits its padding into one 64-byte block, whereas a 56-byte input requires two blocks because the length field no longer fits. Both still produce a 256-bit output. Digest length is not the padded-message length or a reversible compressed representation of the input.
Finite output size necessarily allows collisions over a larger input set; collision resistance concerns the difficulty of finding them. SHA-256 also supplies the hash operation used inside common HMAC and HKDF instantiations, whose keyed constructions and security properties differ from an ordinary unkeyed digest.
SHA-384 2026-11-05
SHA-384 is a SHA-2 cryptographic hash function producing 384 bits. It uses the 64-bit word operations, 1024-bit blocks and eighty-round computation of SHA-512, with its own hash initialization vector. Its result is the first 384 bits of that differently initialized computation.[ref]
Write its final eight-word state as , with each word containing 64 bits. The output iswhere denotes concatenation. Six words give bits, or 48 bytes and 96 hexadecimal digits. The computation still maintains eight state words while processing the message; the shorter output does not reduce every intermediate state to six words.
cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7.The ordinary SHA-512 digest begins
ddaf35a193617aba, so truncating that digest to 48 bytes already disagrees at the beginning. Different initialization, rather than merely a shorter printed result, distinguishes the algorithms.A streaming implementation can process message blocks using the SHA-512 family machinery while retaining the selected variant's initial state and final serialization. Treating those choices as part of the function is essential when a digital signature or HMAC specification names SHA-384. Changing to another 384-bit output transformation changes the algorithm, even if the receiving buffer still has the expected size.
SHA-512 2026-11-05
SHA-512 is a SHA-2 cryptographic hash function with a 512-bit digest. It processes 1024-bit message blocks through eighty rounds using eight 64-bit state words and additions modulo . Its message-length field is 128 bits.[ref]
For bit length , padding appends one bit and zero bits so thatthen appends the 128-bit original length. The hash initialization vector is fixed by the algorithm; it is not a fresh secret for each message. The padded blocks update the state in order, and the final eight words form the digest.
For a computed example, hash the three ASCII bytes
61 62 63. Here , so and . One padded 128-byte block is processed. Its digest, in hexadecimal, isddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f.The 128 hexadecimal digits represent 64 bytes. They do not represent the 128-byte padded input. For another padding-count example, 111 input bytes fit into one padded block, while 112 input bytes require two; the digest remains 64 bytes in either case.
SHA-384, SHA-512/224 and SHA-512/256 reuse the SHA-512 compression structure but have specified different initial states and output rules. Taking a prefix of an ordinary SHA-512 digest therefore does not implement those algorithms. A cryptographic test vector must identify the exact hash, input encoding and expected output rather than only a digest length.
SHA-512/224 2026-11-05
SHA-512/224 is a SHA-2 cryptographic hash function returning 224 bits. It uses the SHA-512 computation with its own hash initialization vector and outputs the first 224 bits of the final state. The SHA-512/t initialization procedure uses the ASCII label
SHA-512/224, so its initial state differs from that of SHA-512/256 as well as ordinary SHA-512.[ref]Output serialization needs care because . If the final eight 64-bit words are , the digest containswhere denotes concatenation in the standard's most-significant-bit-first order. It has 28 bytes, or 56 hexadecimal digits. For a simple serialization example, if were
89abcdef01234567, its contribution would be the four bytes 89 ab cd ef. Taking the four bytes 01 23 45 67 would keep the wrong half. An implementation's machine endianness does not change the specified digest bytes.4634270f707b6a54daae7530460842e20e37ed265ceee9a43e8924aa.SHA-224 of the same bytes begins
23097d223405d822, despite having the same 224-bit output size. The two functions use different compression structures, initial states and message-padding conventions. Taking a prefix of the ordinary SHA-512 digest also gives a different result.The distinction matters in a cryptographic test vector: a 28-byte expected digest cannot identify the intended algorithm by its size alone. The vector must name SHA-512/224 and specify the exact input bytes. The different label used during initialization is fixed by the algorithm; applications do not choose it separately for each hash.
SHA-512/256 2026-11-05
SHA-512/256 is a SHA-2 cryptographic hash function with a 256-bit digest. It uses the 1024-bit blocks and 64-bit word operations of SHA-512, a variant-specific hash initialization vector, and the first 256 bits of the final state. It is one member of SHA-512/t.[ref]
Its initialization illustrates cryptographic domain separation. Let be the eight-word ordinary SHA-512 initial state. First form by applying bitwise exclusive or to each word with the hexadecimal word
a5a5a5a5a5a5a5a5. Run the SHA-512 computation on the ASCII label SHA-512/256, using as its initial state. The full 512-bit result is the variant's fixed initial state . This label computation is part of defining the function, not an extra message prefix chosen by its user.[ref]Secure Hash Standard by National Institute of Standards and Technology. §5.3.6, SHA-512/t IV Generation Function
If denotes the full final state obtained by hashing with that initialization, thenThe output comprises four 64-bit words: 32 bytes or 64 hexadecimal digits. The initial state is public and fixed; it is not a cryptographic salt or a secret key.
53048e2681941ef99b2e29b76b4c7dabe4c2d0c634fc6d46e0e2f13107e7af23.Ordinary SHA-512 of those bytes begins
ddaf35a193617aba, while SHA-256 begins ba7816bf8f01cfea. Neither output implements SHA-512/256. In particular, the slash and output width do not mean “hash with ordinary SHA-512 and keep 256 bits”.The padding also follows the SHA-512 family: a 128-bit length field and 1024-bit blocks. An input of 56 bytes therefore fits into one padded block here, while SHA-256 needs two of its smaller blocks. The identical 32-byte digest sizes say nothing about those different computations.
SHA-512/t 2026-11-05
SHA-512/t is the family of -bit cryptographic hash functions built using the SHA-512 computation with a -specific hash initialization vector and final truncation. The FIPS 180-4 construction takes a positive integer , excluding ; SHA-384 has its separately specified initialization. The 2015 standard explicitly specifies SHA-512/224 and SHA-512/256 as the approved members, rather than treating every permissible parameter as a standardized choice.[ref]
The initialization procedure first XORs each ordinary SHA-512 initial word with hexadecimal
a5a5a5a5a5a5a5a5. It then hashes the ASCII label SHA-512/t, replacing t with its decimal value without leading zeros, using that modified initial state. The resulting full 512-bit value becomes the selected member's fixed initial state.[ref]Secure Hash Standard by National Institute of Standards and Technology. §5.3.6, IV Generation Function
For a concrete word calculation,where denotes bitwise exclusive or. All eight words are modified, not just this first one. At , the label is the eleven ASCII bytes
53 48 41 2d 35 31 32 2f 32 35 36. At , its final three bytes are instead 32 32 34. The slash is an actual label byte, not a division operation or a parser instruction.The generated initial state's first word is
22312194fc2bf72c for SHA-512/256 and 8c3d37c819544da2 for SHA-512/224. These fixed values separate the algorithms before the user's message is processed. Hashing the label with ordinary SHA-512 initialization would follow a different procedure.[ref]After processing the message with its member-specific initialization, retain the first bits of the final state. For an abstract serialization exercise, a state beginning with bytes
ab cd would yield bits 1010101111001; the lower three bits of the second byte are excluded. This illustrates bit truncation, not a recommendation to use a 13-bit digest. Output length, initialization and protocol selection all remain part of the algorithm's identity.