2
$\begingroup$

In this Hacker Noon article, the author seems to give an overview of Merkle trees.

However, I have one problem.

The author claims you can use Merkle trees to verify the authenticity of data, e.g., if a piece of data is authentic.

But I could use a simple hash of the file (signed), for authenticating/checking integrity of a file too, right?

Why employ Merkle trees for this purpose? So it seems that I am clearly missing something. Can someone enlighten me on this?

$\endgroup$

1 Answer 1

4
$\begingroup$

Usually you'd use one hash per file yes, but often torrents consist of multiple files. So you'd have a hash per file and possibly a top level hash to make sure that all the files are present. This way you can validate each file after it is downloaded; downloading and hashing can be performed in any order and in parallel - e.g. from within their own threads.

In principle you could also split the file in sections and hash those separately / in parallel. But with the speed of most hash algorithms this doesn't make much sense. And for integrity you're probably better off using e.g. PAR2 which provides error correction on top of error detection.

As for the authenticity: either the Merkle tree can be loaded from a secure location or the root may be signed, to name two common methods. So yes, you can use a Merkle tree to authenticate data, but you must be able to trust the tree itself first.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.