๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #61022

Re: [FNTP] 'in-completeness'

#61022
From: Curt Welch
Date: Fri, 04 Oct 2002 17:19
160 lines
10244 bytes
claus-usenet-20021004@faerber.muc.de (Claus_F๏ฟฝrber) wrote:
> Curt Welch <curt@kcwc.com> schrieb/wrote:
> > So the type of defense you talk about isn't going to help.  They can
> > post their clone after they have seen your "answer" in the next post.
>
> Another answer to this problem is, of course, to post "index" posts,
> which carry information about all parts of the file, including a SHA1
> hash.
> If you trust this index, you automatically know whether a part fits in.

It seems to me that some form of "index" is a key to this problem.  I've
talked in other articles about the idea of including these indexes with
each data post.

There's no way to trust an index post any more than you trust one of
the data posts, but I think this idea might lead to a workable solution.

What we trust, by definition, is the full-file hash which is what we are
using as the "global name" of the file.  What the download tool is trying
to do is figure out which segments are part of the "real" file, and which
are fakes.

The algorithrm which we know works to do this is to simply reconstrct the
entire file, calculate it's hash, and see if it matches.  If it doesn't,
you know you have bad data somewhere.  But you can't figure out which files
are bad untill you get a full set of valid data.  And if you have a large
post, say 5000 parts of 500KB each, this becomes a real problem.

If you have already downlaoded a complete set of files (and lets assume
that you have colleced posts from 20 different posters over a period of a
month), you have no way of knowing which of your 5000 parts might be the
fakes.

This means the download tool will be forced to download _every_ segment of
every repost it sees on Usenet for that file to check that it matches the
ones it already has. It can throw the extra copy away if it matches what it
currently has, but if it doesn't match (the data is different), it's has to
keep that alternate segment and play the mix-and-match game with all the
alternate segments it finds to try and find which combination of these
files produce the correct full-file hash.

This becomes very unworkable as the size of the file increases.

What's needed is a better hash system to allows us to somehow check
segments of the file and discard them as fakes without playing the huge mix
and match game with Gigabytes of data.

I think something like I talked about in other posts might be getting close
to making this work.

You calculate a strong hash of blocks from the file (so each block has it's
own hash value).  You then hash all the block hash values to create the
full file hash which is used to uniquly identify the file.  You can then
publish an Index which lists the hash values of all the blocks.  And it's
easy to verify that this published index is valid because when you hash all
the hash values, you get the "file hash" you are looking for.  And because
of the stremgth of the hash function you use, it's very hard to generate a
fake index.

Once you have the index, then you can verify, block by block, all the
articles you download.  A forged article could trick you into downloading
it, but it couldn't trick you into using it because the hash values of some
of the blocks would be wrong.

But there are still issues here.  It's a pain to have to distribute these
hash "index" lists.  And what happens when the index is lost.  If it could
be included with every file segment, that would solve the problem of the
"lost" index.  But for very large files, these may get unworkably large
(i.e. every article ends up with 100K of data, and 800K of "index".)

Maybe something even more complex is needed?  What we want is a way to look
at any single article and have it include information that proves it is
part of the file we are looking for without having to look at any other
articles.  And without that "proof" being unresonably large.

Maybe a hierarchy of hashes of hashes would allow that?

You start by dividing the entire huge file into 1K blocks, and calculate an
MD5 of each block.  Then you take those MD5 block hashes, (128 bits/16
bytes each), and combine them into a file of hashes.  Then you repeat.  You
take each 1K block of hashes and calculate a new hash of that. When you get
down to a single hash value, that's the hash value we use to identify the
file.

When you post a segment of a very large file, you post along with it the
tree of hash values for the entire file.  But, you leave off all the leaf
nodes which are not needed to verify only the portion of data posted.

A download tool could then calculate MD5 hashes of each block, and use data
included in the hash tree to re-calculate the full file hash and verify
that it all produces the correct file-hash.

I think something like this might allow for the posting of huge files (with
thousands of parts) while keeping the amount of extra hash data that has to
be posted with each segment down to something very reasonable.

Let me try to calculate....

At each level of this hash tree, you are reducing 1K of data down to 16
bytes. So that's a reduction of 2^10 to 2^4 or 6 binary orders of
magnatude. Or, each 64 hashes get hashed down to 1 hash in this tree.

If you have a 128GB file, then it's got 2^37 bytes.  At the first level
that's transformed in to 2^31 bytes of hash data, which goes to 2^25 at the
next level, and 2^19 at the next, and 2^13 at the next, and 2^7 at the
next, which is 128 bytes (or 8 MD5 hashes), which then hash down to the top
file-hash.

If you post segments which each hold 128K of the orginal file (2^17 bytes),
that means you need 2^20 parts, or 1 million parts. (ouch).  So how much
hash data needs to be included with each segment if we do it that way...

Going from the top of this hash tree down, you need the 7 of the top 8 MD5
hashes, and then 63 of the 64 hashes at each level going down towards the
block of data included in the article. But how many levels is that?

The first block hash covers 2^10 bytes (1K).  The next level hash is 64
times that, so it's 2^16 bytes.  We are posting 2^17 in our file, so the
data spans two hashes at the second level.

The single full-file hash at the top of the tree is level 5, and the data
spans two hash values at level 2, so we need 7 hash values at level, 63 at
level 4, 63 at level 3, and 62 (we can calcuate the other 2 from the data
in the post), and level 2.  So that's 7+63+63+62 or 195 MD5 hashes which
would need to be included with every post to prove that the data in the
post really does hash to the file hash.  And if the data is simply hex
encoded, that. 195*32 bytes per hash, or 6K of extra hash data which has to
be posted with every 128KB segment, which is about 6% extra overhead. (that
also assumes all my calculations above are correct of course).  And this is
for a huge 1 million part post.  The smaller the file, the less overhead
you have to deal with.  And if each article was 2 or 4 times larger, the
total overhead would be 3% or 1.5%.  That seems workable.  and you could
cut that in half again if you used a binary format to send the hash values
instead of hex.

For a 16MB file for example posted in 32 512KB parts, you would only need 3
+ 60 hash values with each post, or 63 MD5 hashes or 65*16 or 1K of hash
data binary encoded added to each 512KB post.

This might be workable (but it's complex enough that not many people will
understand it). This might make it difficult to get the idea supported in a
wide range of tools.

But, if taking hash values of hash values does not create some type of
weakness in the hash, then his means than any given article can be examined
alone and determine if the segment of data really did come from a file
which matches the file-hash in the message-id without the need to look at
any other data from the file.  Forgeries could be thrown out at POST time
on servers if a standard like this became the norm.

For posting programs, there would be a lot of pre-calculation needed to
build all this hash data before the first segment was posted, and it might
require a lot of storage as well to store a lot of this very large hash
tree.  Or maybe most of it could be built on the fly after a single pass
over the file, I'd have to think more about that.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021004131957.981$Cz@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!feed2.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <58068.n92202@archiver.winews.net> <20020924011222.716$tx@newsreader.com> <3147e.o92204@archiver.winews.net> <20020924234811.264$g2@newsreader.com> <15518.p9220c@archiver.winews.net> <20020926003453.621$EG@newsreader.com> <38427.r92204@archiver.winews.net> <1rofajcuom.fsf@vingodur.ifi.uio.no> <20020928124251.046$Da@newsreader.com> <39167.u92203@archiver.winews.net> <slrnapgpct.qiq.andrew+nonews@trinity.supernews.net> <3113g.u92200@archiver.winews.net> <slrnaph54l.qiq.andrew+nonews@trinity.supernews.net> <43236.1a2205@archiver.winews.net> <20021001093905.267$sh@newsreader.com> <30416.2a2200@archiver.winews.net> <20021002113832.345$xh@newsreader.com> <anf7os$me7$1@bob.news.rcn.net> <20021002223806.641$Bd@newsreader.com> <8YE17AvZcDC@3247.org>

Show Full Headers
Complete Article Headers
Message-ID: <20021004131957.981$Cz@newsreader.com>
Subject: Re: [FNTP] 'in-completeness'
Date: Fri, 04 Oct 2002 17:19:57 +0000
From: curt@kcwc.com (Curt Welch)
References: <58068.n92202@archiver.winews.net> <20020924011222.716$tx@newsreader.com> <3147e.o92204@archiver.winews.net> <20020924234811.264$g2@newsreader.com> <15518.p9220c@archiver.winews.net> <20020926003453.621$EG@newsreader.com> <38427.r92204@archiver.winews.net> <1rofajcuom.fsf@vingodur.ifi.uio.no> <20020928124251.046$Da@newsreader.com> <39167.u92203@archiver.winews.net> <slrnapgpct.qiq.andrew+nonews@trinity.supernews.net> <3113g.u92200@archiver.winews.net> <slrnaph54l.qiq.andrew+nonews@trinity.supernews.net> <43236.1a2205@archiver.winews.net> <20021001093905.267$sh@newsreader.com> <30416.2a2200@archiver.winews.net> <20021002113832.345$xh@newsreader.com> <anf7os$me7$1@bob.news.rcn.net> <20021002223806.641$Bd@newsreader.com> <8YE17AvZcDC@3247.org>
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!feed2.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com mDj6Dyc6z4jip0BmtqJwRu=-LldiQoBVV@5g_mLnga0+qK
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: 159