Reputation: 29
There is an arbitrary hash and a merkle root. Actually the question itself is how to find out if the desired hash is part of the merkle root? Without looking up the tree, exactly was our hash previously included in the merkle root or not?
Is there a way to reduce all hashes to one hash and check if the one we are looking for is in the final hash?
Upvotes: 2
Views: 365
Reputation: 1176
Merkle tree hash is generated like this.
let the data array to be hashed are : [ M, E, R, K, L, E, T, R, E, E ]. then steps to generate merkle root hash:
Step 1: generate merkle tree root in pair of 2's. e.g. hash(M,E), hash(R,K), etc
Step 2: hash those hashes in pair of 2-2. e.g. hash ( hash ( M, E ), hash (R , C) ), etc.
step n: the above hashing method is followed till pairs finish and final hash is generated, known as merkle root hash.
now your doubt comes, how you get to know if a hash or data is part of merkle tree or not.
to get to know this, you need all other hashes or data. e.g. if you want to know hash ( M,E ) is part of this merkle tree then u need anyone of these data:-
option 1: final merkle root hash && hash(R,C),hash(L,E),hash(T,R),hash(E,E).
in option 1, you need to generate merkle root with given data, if root come correct, ur data/hash is correct.
option 2: final merkle root hash && hash(R,K), hash(hash(L,E),hash(T,R)),hash(E,E)
option 3: etc.
in short to check weather a data is part of merkle tree u need to complete the tree, if you do not have data, or first hashes of data, you need the hashes which complete the tree, e.g. which can generate final hash of merkle tree.
Upvotes: 0
Reputation: 19546
No, it is not possible to see if the hash you are looking for is "inside" or "part of" the final hash of the merkle-tree. Hash functions are designed that way that you cannot simply get the original input, which went into the hash function. This include the sub hashes from the lower merkle-tree nodes.
Upvotes: 1