🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #62428

Re: xBin (Power-Post 2003 - requesting input from authorities..)

#62428
From: Curt Welch
Date: Tue, 24 Dec 2002 03:29
163 lines
9730 bytes
Rene <invalid@email.addr> wrote:
> curt@kcwc.com (Curt Welch) wrote:

> Which means, that on approximitly 50% of the parts he needs to create a
> colliding hash for the part-data AND the path nodes and for 50% he "only"
> needs to create a colliding hash for the part-data. Ouch !

If the newsreader was cross checking hash tree values between articles,
that's true.  But because of the strength of hash, it's likely that many
tools would not bother.  To verify an article, you can simply read it
sequentially and decode the data and verify it in one pass.  You write the
data out to a file as you decode it and when you get to the end of the
article, you know if the file data is valid or not.  If it's not, you throw
it away, if it's good, you store it with the rest of the file segments you
have for that hashtree file.  You never need to store the hash tree values
on disk, because if you trust your computer to not corrupt your data, you
never need them again.

Well, I take that back.  If you want to re-post parts of the file before
you download all the parts, then you do need to save the hash tree values
from the signature as you get them from each post.  So a more powerful tool
that allowed you to repost segments from your "partial download" would need
to save that - and as long as you are re-constructiong the hash tree and
saving the data as you download each article, why not double check it and
make the job of fake a few orders of magnatude further past "impossible".
:)

> Actually, the number of hashes needed sending (as header data) is a
> function of the number of articles using your xbin. One article at least
> needs the hashes up the path to the root, so thats a guaranteed log2(N).

In another article, I thought the answer was log2(N)+log2(M) where N is the
number of blocks in the complete file and M is the number of blocks in each
article.  But that's not right because if M == N then the number of hashes
needed is 0.  if M is N/2 and M is a power of 2, then the number of hashes
needed for each article is 1.

> Then it additionally needs some hashes if the blocks in the article
> "overlap" into other (sub)trees, but I think that must be less than
> log2(N) additional hashes (need to think it over though). I think the
> worst case is where the blocks overlap from the left-subtree into the
> right-subtree (ie, crosses the "middle") because if it stays in its
> subtree, then sooner or later up the path you reach a node you already
> have, if you pass over to the right side however, you have a full
> sub-tree to traverse upwards.

For a file which has a power of two number of blocks, I think you are right
and the worse case happens when the article has 2 blocks which overlaps the
the center of the file.

Ah, I'm beginning to see it.  This is the same problem as counting the
number of bits turned on in a binary number.

If you look at the number of blocks to the left of the file segment, and
represent that number in binary, and count the number of 1s in that binary
number, that is the number of hash values you need to represent the top of
the tree hash for that part of the file.  And then you do the same for the
blocks to the right of the segment in questions to see how many hash values
are needed for that side.

Ah, but it's not even that simple because that gives you the correct value
for the left side (which starts at the beginning of the file and is
correctly aligned with the binary tree), but the number required for the
right side depends on the alignment of the block with the binary tree for
the entire file.

Worse case is still close to 2log(N).  Ah, but maybe it's even worse than
that at times depending on the file size and the alignment of the segement
because of the complexity of what happens on the right side?

I think some work is required here to get a better understanding of this
because the worse case effects the max size of the Signature header, and
that can limit the max possible file size which can be posted using this
system while still keeping the header length to a size which various news
servers can correctly deal with (which I think is around 1000 bytes).

Let see, the hash and a few spaces takes up about 30 bytes per hash so that
gives us around 32 hash values max in one header. If 2log2(N) is the worse
case, then 16 = log2(N) or N == 2^16 is the max file size that can be
posted without risking the hash header overflowing.  With a block size of
4500, that gives us a max file size of around 300 MB before the hash header
may end up being greater than 1000 bytes.

That's not as high as I'd like to see.

One option I guess is to use a larger hash block size, but doubling the
block size only doubles the max file size, and I'd like to see something
that would allow a file size much much larger (100 GB) for example.

The larger the parts the less hash values you need, but I'm not sure how to
calcuate that.  Maybe the answer is if want to post a 100GB file you have
to do it with 10MB posts. :)  That's not an unresonable requirement.  Also,
if the articles each hold an even power of 2 number of hash blocks, that
reduces the worse case problems.  So many be the answer is that for really
large files, the posting program has to be smart to avoid a header overflow
problem.

And manybe I'm wrong about header length probelms.  For a header which the
news serers don't have to deal with, and which the news reader is only
going to get by doing a HEAD command, there may not be any news servers
which care that there is a 2K header in the artcle?  Anyone know?

> > calacute an SHA-1 hash of a 20MB file, the SHA-1 code has to calculate
> > 1 million hash values on the 20 byte SHA-1 hash blocks.  To calcuate
> > the
>
> Hm I think you don't have an accurate picture on how the hash algorithms
> work.

I do.  I just iddn't know SHA-1 worked with an internal block size of 64
bytes.

I was also fairly sure that MD5 used an internal block size which matched
the hash size of 16 bytes, but I could be wrong about that as well.

> The way par files work is pure mathematics. Actually it's all matrix
> operations as far as I understand it. Still I'd need to read up on quite
> a lot of things to understand it entirely.

If you care, here's a really good description of the algorithm written for
programmers to understand (it's in PDF):

http://www.cs.utk.edu/~plank/plank/papers/CS-96-332.html

Once you get a basic understanding of it, it's really not as complex as it
seems at first.

I might have some numbers wrong, but I think this is basically it:

Reed-Solomon is simply a set of linear equations where each equation acts
as a check-sum algorithm.  Though the math behind it is defined for real
numbers, the mathamaticians figured how to map it to binary numbers of any
bit length.  For 8 bit numbers, the system defines 256 different equations
that can each caluate an 8 bit "check-sum" for up to 256 8 bit data values.
For all sets of 256 data values, the equations always guarantee to generate
256 different check-sums.

Each equation is used to generate a single PAR file for up to 256 data
files. It's done byte by byte.

If you have any data files missing, then what you are left with is a set of
simultanious equations with N unknowns where N is the number of files you
are missing.  As long as you have N or more equations (i.e. par files),
then you can solve using substitution for the unknown variables (files).

> What you propose is not mathematics. It were if you'd bring your own hash
> algorithm. But that's not wise, we are in the nice position that we can
> just take the work of the cryptographers. All you do with your system is
> add some data here, build up a tree, a basic memory structure for any
> serious programmer, and traverse it, ocassionally read or write a value
> to a node.

I re-envented the wheel much like you did thinking of this problem, but
hash trees I found out have been well known for many years in crytology.

And the use of hash trees for this same purpose (distribution of partial
files over an unscure medium) has been defined for use with P2P I found.
Search for "bitprint".

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021223222931.632$dl@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-mail
References: <cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com> <20021223041127.986$6M_-_@newsreader.com> <1rfzsoaacf.fsf@vingodur.ifi.uio.no> <20021223150103.132$Bb@newsreader.com> <20021223185650.674$Oy@newsreader.com> <20021223195619.621$Gg@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <20021223222931.632$dl@newsreader.com>
Subject: Re: xBin (Power-Post 2003 - requesting input from authorities..)
Date: Tue, 24 Dec 2002 03:29:31 +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> <20021223150103.132$Bb@newsreader.com> <20021223185650.674$Oy@newsreader.com> <20021223195619.621$Gg@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-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com Nx5t+Hc3LJSTQZHRbxZxKhu=UZLWhyLF@syeGCQsnTK4mM
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: 162