PDA

View Full Version : How to verify piece of file


Maxy
July 9th, 2007, 02:26 PM
Hi There,

I would like to know, how is it possible to verify part of file downloaded from a host. I know, I have to use THEX (Tree Hash Exchange Format) for this purpose.
But I'm not sure how to use it.

When I get positive reply from a Limewire host to upload a file. In the reply I could see
"X-Thex-URI: /uri-res/N2X?urn:sha1:TY2462FV2IEMADVXYA52IX72H2GTA3C7;JGJO CMQ3LSZD7JS24GQHG3O3EPIQJUTV4GPUMXA"

I know the first hash value is the sha1 has of the complete file. But dont know the hash just followed by it.

How can I use this information to verify the the part of the file?

Thanks in advance,

Maxy

Sam
July 9th, 2007, 02:59 PM
The second part is the tigertree root. You can send a request to the LimeWire for ' /uri-res/N2X?urn:sha1:TY2462FV2IEMADVXYA52IX72H2GTA3C7' (everything after X-Thex-URI up to and not including the semicolon), which will send the full tigertree in DIME format. You can use that tree to verify the file. For information about THEX, see: http://open-content.net/specs/draft-jchapweske-thex-02.html

Maxy
March 5th, 2008, 01:11 PM
I have few questions regarding verification process:-

1) What is the minimum amount of data to receive to verify that this piece is not corrup or fake. Is it 1024 bytes or depends on the depth of the Tree?

2) If i receive a part of the file, then how would I know,at which level this file part belongs on the tree? So, that I could compute THEX.

Thanks,

Maxy

Sam
March 5th, 2008, 03:16 PM
You can read more about hash trees here: http://en.wikipedia.org/wiki/Hash_tree . There's a lot of links to places that describe it in more detail.

The answer to 1) depends entirely on the depth of the tree. If you have the full tree (from the bottom 1024 bytes of the file), then yes, it's 1024 bytes. Most trees aren't that detailed, so it will be some number over 1024.

The answer to 2) depends on what you mean by 'level'. I haven't seen any source anywhere that clarifies what all the terms mean. For the sake of discussion, let's consider each 'row' of the tree to mean the same as a 'level' or 'slice' of the tree. That is, in a balanced tree, the top level has 1 root hash, below that is 2, below that is 4, below that is 16. Each individual 'hash' we can consider a 'chunk'. So level/row/slice mean the same, and chunk refers to a specific element within a given level.

Using those terms, a every level encompasses the entire file. Each chunk on the level just applies to a different granularity of the file. A level with 4 chunks can split the file into 4 pieces, a level with 8 chunks can split it into 8 pieces, etc... You typically want to use the lowest possible level to have the finest granularity possible, especially if you determine the chunk is corrupt, in order to not throw away valid data.

Maxy
March 26th, 2008, 04:10 PM
So when I request for complete merkletree from a host, I will get list of leaf hashes, the first one is root hash. The remaining are leaf hashes at the lowest level?

So I could compute rooth hash by iteratevly computing Internal Hash of the leaves?

Thanks in advance,

Maxy

Maxy
August 4th, 2008, 12:46 PM
Hello Group,

I have few questions regarding partial file verification:

1) With how many users does Limewire verify root hash, to make sure the piece of a file is valid? Or is there any guideline for it? In case, If there is a singer user and if we need to verify peice of a file from that user. The user could fake binary(file ) and fake tiger tree as well.


2) Does all clients out there compute tiger tree in same way? I mean, is it possible two clients computing hash tree with diffrent nodesize or treedepth? Then, it would turnout it would be not possible, to verify piece of the file with diffrent tiger trees.

Thanks in advance,

Tahseen..