Article View: news.software.nntp
Article #62420Re: xBin (Power-Post 2003 - requesting input from authorities..)
From: Curt Welch
Date: Mon, 23 Dec 2002 23:23
Date: Mon, 23 Dec 2002 23:23
66 lines
4349 bytes
4349 bytes
Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote: > [Kjetil Torgrim Homme]: > > > > (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.) > > let me expound a little on that. if we let the block size be 64 KiB > and someone posts 192 KiB parts, it will look like this internally: > > +---------------+ > | | > +---------+ | > | | | > +----+ + - - + +----+ > | | : : | | > a b c d e f > > == part 1 == == part 2 == > > so, part 1 needs to contain the hash of "ab" The hash of part 1 can be calcuated from the data. The hash of part 1 needs to include the hash of the rest of the file, which is hash d, and (ef) which you didn't give us a label for in your graph. > (using Rene's > nomenclature :) and the hash of "c". including the hash of "a" and > "b" individually is wasteful. this means the the hash must be marked > with its position in the tree somehow in the signature. or maybe not. Right. It's not needed. To calcuate a tree hash given the full file, you just make a single pass over the file calculating the hash values. You don't have to store the entire tree as you do this, you only have to store one hash value for each level of the tree. So for each level in the tree, the hash values end up being calcuated left to right in your diagram above. When you pre-scan the file before posting however you do need to save most of the hash tree so you can spit out the correct hash values in each signature. To calcuate the hash given the signature hash values and the data from a single post (and I've not tried to write this code yet so I may be missing something) you can do depth first search of the tree, but for each node in the tree you calcuate the range of blocks that node represents. Once you hit a node which has no blocks overlapping the data in your current file segment, you know that the next hash from the signature is the hash value for that node, so you grab the next hash from the list, and return it up to the previous level has the hash value. For any node which overlaps some data in the file (but is not completly included in the current article), you just need to recurse down to the next levels. When you get down to the data block, you just scan it calculate the hash value for it. That algorithm will both take hash values off the signature line in the correct order, and end up scanning the data blocks from the current article in sequence as well, and when it's done, it has a tree-hash value for the entire file. If that matches the one in the signagure, and also matches the message-id, and you don't have extra hash values left over in the signature, then you know all the data is valid. -- Curt Welch http://CurtWelch.Com/ curt@kcwc.com Webmaster for http://NewsReader.Com/
Technical Details
Message-ID:
<20021223182307.992$mv@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!feed1.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> <1r8yyga8vg.fsf@vingodur.ifi.uio.no>Show Full Headers
Complete Article Headers
Message-ID: <20021223182307.992$mv@newsreader.com>
Subject: Re: xBin (Power-Post 2003 - requesting input from authorities..)
Date: Mon, 23 Dec 2002 23:23:07 +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> <1r8yyga8vg.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!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com Qr/AVr-mpMCFYtyClptU+VELkE_epM,9B./_w8__FWo7oOj
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: 65