Basic properties of some hash functions Let $b_1, b_2, \dots, b_n$ be blocks of a fixed size.
We take our hash function to be $H(x)$, for example SHA1.

What is the result of $H(b_1 || b_2 || \dots || b_n)$?

Edit:

Let me formulate it more clearly.
So I want to know if the following properties (or any other similar property) hold:


$H(b_1 || b_2) = H(H(b_1) || H(b_2))$
$H(b_1 || b_2) = H(b_1 || H(b_2))$
$H(b_1 || b_2) = H(H(b_1 || H(b_2)))$
Associativity (I assume it's not the case)
Commutativity (clearly not the case)


For any hash function like MD5, SHA1, etc.

Edit 2:

Okay, so how are large inputs treated by decent hash functions? Will the blocks be xored, then hashed. Is there a pattern or is it completely different from function to function?
The old hash functions you mention (MD5, SHA-1) are based on the Merkle-Damgård construction. SHA-3 uses a sponge construction instead. There are certainly more variations possible, but these are the popular ones.

There are multiple constructions possible but for most hash functions the input is indeed split in blocks. These blocks are directly put in some kind of compression / sponge function which is used to update the state of the hash function. A hash function also has an initial state provided for when zero blocks have been processed.

Generally the last block is padded and a length of the input is included to create the final state. In the case of MD5 and SHA-1 the state is directly output as the hash value, but in more modern hash constructions there may be more processing before the final output is produced. This happens for instance for SHA-3.



A hash function is required to always produce a different output for any different input. As they may process a virtually unlimited amount of input while producing a small amount of output there must of course be many messages that produce the same output; this is called the pigeon hole principle.

It is however computationally infeasible to find those input.at least when the hash function is not broken. MD5 is such a broken hash function for which this property is clearly not true anymore.

So lets visit your questions with this knowledge:


$H(b_1 || b_2) = H(H(b_1) || H(b_2))$ - clearly different inputs
$H(b_1 || b_2) = H(b_1 || H(b_2))$ - clearly different inputs
$H(b_1 || b_2) = H(H(b_1 || H(b_2)))$ - clearly different inputs
Associativity (I assume it's not the case) - clearly different inputs
Commutativity (clearly not the case) - clearly different inputs


So, no, hash functions do not possess any of these mathematical properties, which is not surprising if you consider that it should be infeasible to reverse a hash value.

It's much more interesting to have a look at how the internal compression function or sponge function behaves.