2
$\begingroup$

I have been reviewing the documentation for SHA256 and I believe the last two words (64 bits) for each chunk are not used in creating the message schedule.

From Wikipedia...

Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array:

for i from 16 to 63
    s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3)
    s1 := (w[i-2] rightrotate 17) xor (w[i-2] rightrotate 19) xor (w[i-2] rightshift 10)
    w[i] := w[i-16] + s0 + w[i-7] + s1

Notice how w[i-1] and w[i] are not used? These two words would be the length for a 1 chunk hash but for actual data that is longer then 512 bits the last 64 bits are ignored. This would result in the same hash for two (or more) messages. Am I missing something or am I correct?

$\endgroup$

migrated from security.stackexchange.com Dec 23 '15 at 18:19

This question came from our site for information security professionals.

1
$\begingroup$

I've figured it out. The Message schedule is 64 words in length where as the chunk is only 16. The schedule contains a copy of the chunk in the first 16 words then smears the original 16 words in the chunk to the remaining 48 words.

$\endgroup$
  • $\begingroup$ Indeed. It's a key expansion in a way: the message is the key for the cipher (at the core of SHA26) and is expanded from 16 32-bit words to 64 32-bit words. The state is then handled as the message (with a xor feed forward for non-reversibility) $\endgroup$ – Henno Brandsma Dec 23 '15 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy