Article View: news.software.nntp
Article #62418Re: xBin (Power-Post 2003 - requesting input from authorities..)
From: Curt Welch
Date: Mon, 23 Dec 2002 23:05
Date: Mon, 23 Dec 2002 23:05
157 lines
9485 bytes
9485 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote: > [Curt Welch]: > > > > Putting the correct file information in the Message-ID also allows > > downlaod tools - especially ones searching multiple servers - to > > only download the message-ids from the servers (XHDR Message-ID) > > and still be able to correctly identify all the parts of a > > multipart file post. > > just a clarification: all the _candidate_ parts of a multipart file > post. it needs to download the header (X-Bin-Signature) of the > candidates to identify the bogus parts. Well, the signature doesn't tell you it's bogus. YOu have to download the entire article to check if it's really bogus. If the x-bin-signagure was missing from the header, that would tell you it's bogus, but anyone trying to create fakes would most likely get that right. And flase postives on a Message-ID would cause an article to look like a valid candidate but the odds of a 60 bit hash and a filesize matching is small enought that that is unlikley to be an issue as well. I would expect most download tools to download the entire article after seeing the correct Message-Id and not bother with the extra stop of a header download to check for consistency. But it could of course be done. It would be up to the download tool author to decide if they felt the extra step and the code to implement it was worth doing. > > Hash trees are a special type of file hash which is built using > > any standard hash function like MD5 or SHA-1. They are bit > > complex. But they work by dividing a file into blocks, and > > calculate a hash for each block. Then, for each two adjacent > > blocks, you take the two hash values, treat them as one set of > > data, and calculate a hash of that data. You continue doing this > > calculating hashes of combined hashes in a big binary tree, until > > you get to the top and have only one hash value left. That > > becomes the "hash" of your file. > > let me see if I understand you correctly. let's say it's a 13 part > posting. > > l > +----------------------------+ > j k > +--------------+ +---------+ > | | | | > g h i | > +------+ +------+ +------+ | > | | | | | | | > a b c d e f | > +--+ +--+ +--+ +--+ +--+ +--+ | > | | | | | | | | | | | | | > 1 2 3 4 5 6 7 8 9 10 11 12 13 > > "1" is the hash of part 1, "a" is the result of hashing the > concatenation of "01" and "02", "g" is the result of hashing the > concatenation of "a" and "b", and so on. > > part 1 should include its own hash, as well as a, g, j, and l. Right idea, wrong answer. To verify the data in the part, you must re-calculate the hash from the data. to see if it matches. So the hashes you listed are the ones which you must calculate, not the ones which will be included in the header. So what you include with part 1 is hash 2, b, h, and k. What the code calcuates are the hash values a, g, j, l when it wants to verify the data is part of a file with a tree-hash value of l. > part 4 should include its own hash, as well as b, g, j, and l. A posted part can included multiple blocks. So lets say a single article included blocks 4 and 5. To recalcute the tree-hash for the file, you would need to include the hash values a, 3, on one side, and 6, d, and k from the other. The order of the hash values in the Signature: header follow that same order so you don't need to identify which hashes is which in the header. Each hash covers a unique range of blocks from the file, and the order of the hash values in the header match the order of the blocks in the file. Which hash values need to be included is known by the program because The signature header starts with the full file hash (which is only requried there since I'm suggesting not including the full 160 bits in the Message-ID), and then is followed by the hash values required from the file in the correct order. > part 13 should include its own hash, as well as k and l. > > the assembly program can notice discrepancies both by comparing hashes > (the "g" of 1 should be equal the "g" of "4"), and by verifying that > the hashes are correct (the hash of "a" from 1 and "b" from 4 should > equal the "g" found in either). You don't even need to do that if you trust the strength of the hash (which is the whole point here). All you need to do is re-calcaute the file-hash and make sure it matches the full-file hash of the file you are trying to download. This works much like a normal hash of the entire file in terms of verifying that the data is what you were looking for. The advantage of the tree hash is that you can calcaute the entire file hash given only a small segment of data from the file, and a small handfull of hash values for the rest of the file. The hash values in the signature are data as well because they all get hashed. So it's just as hard to fake those as it is to fake the file data. > (this ignores the possibility that the size of a part is not a power > of two multiple of the chosen block size. in that case, each part > must contain the hashes of its internal tree.) You just include the hashes which outline the internal tree. The internal tree hash values are re-calcuated from the data to prove the data is correct. The number of hash values in the signature is worse case something like 2 * log2(N) where N is the number of hash blocks in the file. Most times, the number is closer to just log2(N). > > But the larger side-effect is that because of the way the > > tree-hash works, the file segments you post must be sized so they > > start and stop on the tree-hash block boundries. > > you mentioned the problems finding a block size which fits the > uuencode line length. I think you should ignore that problem. if the > software is written correctly, it will handle the "short" line without > problems. also, neither MIME nor yEnc has this problem, so I think > it's unnecessary to make the block size something obscure just for bug > compatibility with uudecode. I thought that too. I assumed block sizes which were a power of 2 would be more logical. But in fact, the job of calculating the hash in the first place is a problem of reading "blocks" which match the hash you use. for SHA-1, it works in 20 byte blocks. So it's working with an obscure block size already which fails to fall correctly across any power-of-two sized blocks. Yet that really has no measurable effect on the speed of calculating the hash because the problem is always a simple sequential scan of the file which is well optimized on all systems already. I finally picked a hash block size of 4500 bytes. That's 100 uuencoded lines of data. That way, uuencode segment sizes must be a multiple of 100 lines - which is already a "norm" for uuencoded files. And 4500 bytes is an even multiple of the 20 byte blocks which sha-1 already uses so you could even argue that as being better than any power-of-two block size. But in fact, it's not really important. The code is just as fast if you use block sizes of 4513 which is prime and falls across nothing "normal". The issues which did seem important as that the larger the block size, the less hash values you need in the signature. So bigger is better for that. But since parts must be split on block boundries, the bigger the block, the less granularity you get when trying to pick an article size, which means if you try to make all the articles the same size (a good thing), the ability to do that is limited by your block size. 4500 seemed to be a good number for uuencode as well as a reasonable balance between granularity and hash signature size. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20021223180543.105$Wn@newsreader.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mailReferences:
<cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com> <20021223041127.986$6M_-_@newsreader.com> <1rfzsoaacf.fsf@vingodur.ifi.uio.no>Show Full Headers
Complete Article Headers
Message-ID: <20021223180543.105$Wn@newsreader.com>
Subject: Re: xBin (Power-Post 2003 - requesting input from authorities..)
Date: Mon, 23 Dec 2002 23:05:43 +0000
From: curt@kcwc.com (Curt Welch)
References: <cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com> <20021223041127.986$6M_-_@newsreader.com> <1rfzsoaacf.fsf@vingodur.ifi.uio.no>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com o1oNQevwf6ktzA-f,a-HYictjX3KP5cARfObVDCFCX/Os==9
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
%IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 156