I was reading the following on Wikipedia, it appears that the leaf nodes are hashed. What are the benefits of this? Why is it done?. I fell like they are done so that they can be transferred securely. However, I am not sure about this, would like some points to resources
2 Answers
Merkle Tree is based on hashing to the root to provide an efficient digital signature. If the leaves just contain a single data then the parents cannot contain the hash of both children and the combined hash in a simple node design. This can complicate the structure and programming so that the last parents must contain the hash of their children and their combined hashes, too.
You can design like that, however, it will not simple as the Merkle tree. For example, as pointed on the patent, you can design a Merkle tree trinary tree too.
This is rather an efficiency issue, not a security issue if the hash chain still has the countermeasure to prevent the second pre-image attack with the prefixes.
- 49,797
- 12
- 123
- 211
If you only send the root and the Merkle tree is just used for parallel hashing then it doesn't matter how the tree is written down. The algorithm works even if you have the intermediate nodes describe $\operatorname{hash}(L1) | \operatorname{hash}(L2)$ instead of $\operatorname{hash}_1 | \operatorname{hash}_2$ as they are fully equivalent. In the end only the root (and possibly the tree configuration) need to be known by the verifying party.
You can also use the Merkle tree to quickly change the root hash if one of the elements changes, without having to re-hash the entire message. In that case you need to have the hash of the element present in the tree. So in that case at least the leaf hashes need to be communicated (although communicating the entire tree avoids recalculation). If you'd combine hashes then you'd have to hash two elements - basically removing a level.
- 96,351
- 14
- 169
- 323