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.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.
Articles by others on the same topic
There are currently no matching articles.