So, reading the chapter about hash functions from the book "Applied Cryptography". There's a point where, as a conclusion, the construction:
SHA-X(SHA-X(0^b || m))
Saying:
Prepending the message with a block of zeros makes it so that, unless something unusual happens, the first block input to the inner hash function im hd is different than the input to the outer hash function.
The thing is I don't quite get it.
Forgetting about the prepending of a block of 0's to the inner hash function, let's state that it's clear that:
If we find a collision for the output of the inner hash function, then we get a collision for the output of the outer hash function.
So, how is it different prepending a block of all 0's to the message to mitigate length extension attack?
If I have the messages:
m=m1..mk
m'=m1..mk,mk+1
When prepending a block of 0's to both of them as input for the inner hash function will give us the same "problematic" situation we have with length extension attacks. We will have a partial message collision up to
0b||m1..mk
And then we have mk+1
"to play" and be able to generate a length extension attack...
I'm aware that there's obviously something wrong with my reasoning, so I'm hoping someone can give me a hand and point out what it is.