In a hash tree, are non-leaf nodes direct hashes of data, or are they hashes of sub-hashes?

370 views Asked by At

I am looking on the wikipedia article for hash trees, and I am slightly confused by their diagram.

A leaf node obviously contains the hash of the underlying data.

Are leaf nodes in hash trees different than any non-leaf node? Do non-leaf nodes contain hashes of data, or hashes of hashes?

Given this diagram:

Hash tree diagram

Which of these is Hash 1 a hash of?

  1. Hash 1-0 + Hash 1-1
  2. Data block 002 + Data block 003

Or are hash trees fundamentally different depending on the application (rsync, P2P networks, Git, etc)?

1

There are 1 answers

1
Lyth On BEST ANSWER

This is what wiki article says:

Nodes further up in the tree are the hashes of their respective children. For example, in the picture hash 0 is the result of hashing hash 0-0 and then hash 0-1. That is, hash 0 = hash( hash 0-0 || hash 0-1 ) where || denotes concatenation.

But I truly believe that a developer may customize the tree and algorithm, use different hash functions and so on, optimizing it for different data or speed or memory or whatever.