Assuming we use SHA256 as hash function. In practice you see that a Merkle tree is used to concatenating multiple hashes together to one single root hash.
A Merkle tree is a binary tree which always takes two SHA256 hashes and concatenate them in a recursive manner.
My question: Is it insecure to hash more than two hashes together? Say for example you want to create a unique hash of a folder structure. Each folder can contain an huge amount of files which are separately hashed. If we now concatenate the hashes in a sorted way:
SHA256(concatenate(sort(SHA256(file 0), SHA256(file 1), SHA256(file 2), [...], SHA256(file n-1))))
Does this increase the risk of a collision?
Explanation: You can imagine that an attacker wants to prove that a file was part of the hashes (through the root hash) which it was not. So he can choose n-2 hashes freely and try to calculate the root hash (collision). Does this (dramatically) increasing the chance of a collision?
I can not find precise information about that online. My stomach feeling points me to the birthday problem. And kind of the existence of a Merkle trees is pointing in the same direction. Or am I wrong? I would be really happy for any hint. Thanks!