Questions tagged [hash-tree]

A hash tree (or Merkle tree) is a method of hierarchically hashing data. They allow efficient parallel hashing and updates and the possibility of verifying partial data.

A hash tree (or Merkle tree, named after Ralph Merkle, who patented them in 1979 for use in combination with the Lamport one-time signature scheme) is a method of hierarchically hashing data.

In a typical hash tree implementation, the data to be hashed is first split into a number of segments (if it is not already so structured). Each of these segments are hashed using an ordinary cryptographic hash function, with the resulting hash values forming the lowest level of the tree.

The hash values at the lowest level are then divided into groups, often of fixed size. (For example, in a binary hash tree, each group would consist of two hash values.) These groups are then each hashed, with the resulting hash values forming the second-lowest level of the tree, and so on. This process is repeated to build the tree from the bottom up, until, at the top level of the tree, only a single hash value remains.

The single hash value at the top level can be used to verify the entire dataset. However, if the hash values at intermediate levels of the tree are also transmitted, they can be used to verify parts of the data without requiring knowledge of the rest. Also, if parts of the data are changed, the hash tree can be efficiently updated by only recomputing the parent nodes of the changed segments. These features make hash trees useful for verifying the integrity of filesystems or databases, as well as for detecting errors in data transmitted out of order e.g. over peer-to-peer file transfer networks.

Another benefit of hash trees over conventional hashing is that, since different branches of the hash tree may be computed independently, the hash calculation and verification can be easily parallelized.

Some care is needed when designing practical tree hashing schemes to avoid collision or preimage attacks, particularly relating to the choice of hash functions used at different levels of the tree, as well as the handling of input data whose length in segments is not a power of two (or, more generally, of the number of children per node). For example, in a naïve hash tree implementation, where the same hash function was used for all levels and the hashes of child nodes were simply concatenated to obtain the input for the parent node's hash, an attacker would be able to trivially generate second preimages of the root hash simply by submitting the concatenation of the second-level hashes as a message.

97 questions
18
votes
2 answers

Merkle hash tree updates

It seems that merkle hash tree (MHT) traversals have been discussed somewhat in the literature, but there does not appear to be much written on inserting, deleting, and updating leaves. Is this lack of material regarding updating MHT's possibly due…
user3150164
  • 303
  • 2
  • 6
8
votes
1 answer

Is it possible to build short proofs of arbitrary computations over a big list?

With the use of Merkle Trees, you can prove the presence of an element of a very big list, with an amount of information logarithmic in the size of the whole tree. Merkle proofs, thus, probabilistically confirm the result of this specific…
MaiaVictor
  • 1,345
  • 8
  • 16
6
votes
1 answer

Proof of membership and non-membership in Merkle tree (Hash-tree)

If we just know the Merkle root and the data block and we want to know this block is a member of this merkle tree. We need to know all the blocks from the leaf to the root that are associated with data block and we ignore the rest. But how and whats…
Sai Teja T
  • 183
  • 1
  • 5
6
votes
1 answer

Dynamically building a Merkle tree for unkown size

Assuming a $k$-ary Merkle tree: If the length of a file is known, based on a fixed chunk size, one could calculate the number of chunks and thus the depth of the tree. Then, based on $k$, the chunk index and the depth, one can parallelize the…
4
votes
2 answers

Proving set membership in less than $\log{N}$ bandwidth

I have an unchanging set of unique items, and I want my server to show one of those items to a client, then cryptographically prove that the item is part of the set. How I do this currently: Generate a Merkle tree containing all of the items. Give…
Nick ODell
  • 364
  • 1
  • 10
2
votes
1 answer

Comparing n-multiple amount of merkle trees?

I would like to know what best steps are there in finding differences between a high order amount of merkle tree's or if a better associative structure should be used. I ask this questions because while i have found on comparing two trees for…
latrasis
  • 131
  • 2
2
votes
1 answer

How are the lower levels calculated using upper levels in an optimized Merkel Hash Tree?

I was reading about the TIK protocol for thwarting wormhole attacks on adhoc networks. It uses a Merkel Hash Tree to store keys. But since the number of keys can be large, the tree is optimized by only storing the upper levels. As far as I…
ritratt
  • 125
  • 3
1
vote
1 answer

Usefulness of blockchain technology in private sector

I understand that blockchain technology works for cryptocurrency. But I don't get why it should be used in private sector. For example, I often read that it is useful to monitor the supply chain of food. But why is that? If a company uses blockchain…
DanielG
  • 121
  • 3
1
vote
1 answer

Merkle tree vs chronological merkle tree

I've been reading some papers about using blockchain in VANETs (Vehicular Adhoc Networks). Some of them have mentioned something called a chronological merkle tree (CMT). Is this different from the normal merkle tree? Here is a quote from one of…
Abol_Fa
  • 73
  • 7
1
vote
0 answers

Security of querying multiple Merkle trees

Suppose Alice has committed to several sets of values using Merkle trees. For example, let's say there are 2 sets of values, and each set represents leaves of a separate tree like this: $a_0, a_1 ... a_n$ are the leaves of tree $A$ $b_0, b_1, ...…
irakliy
  • 969
  • 7
  • 16
1
vote
1 answer

Can proofs be generated from Merkle Patricia Tries in the same way as merkle trees?

I'm kind of confused about this, I have read that nodes in Merkle Patricia tries are key-value pairs, can someone provide a proof of membership for a data in a Merkle Patricia Trie just as he would with a Merkle tree? That is, providing hash of some…
Abol_Fa
  • 73
  • 7
0
votes
1 answer

Verifying Merkle root correctness without completely reconstructing the tree

Lets say Alice has a list of values, and Bob sends Alice a Merkle root that he claims is for this list of values. The Merkle tree construction algorithm is mutually known of course. Alice can then pick arbitrary values from the list and ask Bob for…
Adam Ierymenko
  • 896
  • 6
  • 20
-1
votes
1 answer

Merkle Tree Proofs Implementations

I'm currently implementing a Merkle Tree in Rust. One of the problems I'm facing is the complexity of generating the proof. Meaning the vector I give to the verifier in order to check if an element is present. Many people say that I should…
Tito
  • 1
  • 1