🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
33 messages
33 total messages Started by Chris AtLee Tue, 08 Apr 2003 05:21
xBin library version 0.1
#64775
Author: Chris AtLee
Date: Tue, 08 Apr 2003 05:21
41 lines
2787 bytes
I've just completed basic testing on my xBin implementation.  It can be
found at:

http://atlee.ca/xbin-0.1.tar.gz

I've developed this on my Debian linux system, so it may take some
tweaking to get working in Windows.  I'd be interested in any patches or
suggestions people have on it.

The current make target is the xbintest application which accepts a
filename on the command line.  It calculates the hash tree and all the
Message-ID headers and Content-SHA1-Tree headers and then verifies a
"message" using only those headers.  Hopefully it will print out "Part i
OK" for each part in a file :)

For binary posting software, the functions of interest are:
xbMakeTree - makes a hash tree from a given file
xbCalcPartSizes - figures out how big articles should be
xbMakeMessageId - generates a string to include in the Message-ID header
xbMakeTreeComplement - generates a string to include in the
Content-SHA1-Tree header

For news readers, the only function you really need to know about is
xbVerifyMessage, which looks at an article's headers and (decoded!) data
to determine if the data in the article together with the hashes in the
Content-SHA1-Tree header can be combined to get the root hash.

Things left to do are:
Re-organize into smaller files
Finish repost request, fileset and parity data article support
(Most of the code for generating parity data and using it to recreate
articles is already there in xbrs.c, but the interface needs work)
More testing is needed, I got rid of some major memory leaks, but there
are probably smaller ones hiding around in there.
Make sure it builds on Windows
Shared library build
Integration into popular news posting / downloading tools :)

Cheers,
Chris
Re: xBin library version 0.1
#64778
Author: Mirco Romanato
Date: Tue, 08 Apr 2003 16:42
63 lines
3731 bytes
"Chris AtLee" <catlee@canada.com> ha scritto nel messaggio
news:pan.2003.04.08.05.21.36.142899@canada.com...
> I've just completed basic testing on my xBin implementation.  It can be
> found at:

> http://atlee.ca/xbin-0.1.tar.gz

> I've developed this on my Debian linux system, so it may take some
> tweaking to get working in Windows.  I'd be interested in any patches or
> suggestions people have on it.


Your work is very interesting.
I'm now are documenting myself about nntp binary posting, utility and source
code.
This because I want to code a plug-in for Shareaza (www.shareaza.com) when
the plug-in SDK will be published.
The plug-in is aimed to integrate the binary newsgroups distributions
channel with the P2P Gnutella network.
Apparently to integrate the two network is needed that the posts with a
binary file chunk have:
1) the SHA1 hash of the original file
2) the TigerTree hash (TTH) of the chunk (chunks are better with a size of
1024*2^N bytes with N from 0 to 10)
3) the starting and ending points of the chunk in the file and maybe(for
cosmetical reason mainly) the size of the file

For info, look at http://bitzi.com .
The have an utility called bitcollider with available sources for compute
SHA1, TTH, e2K hashes (MD5 based for edonkey2000 and eMule) and UUhashes
(for the Fasttrack network). It also extract available metadata from various
files with metadata embedded like MP3 and other sound and video files (but
extensions for PDF and other are on the way) and also compute the hashes for
data only with the metadata bytes stripped (for MP3 I'm sure).

If a post contain in the header the bitprint of the complete file (bitprint
is the concatenated "SHA1"+"."+"TTH"), but either the only SHA1 or TTH will
do the work, and the starting and ending point of the data in the file, an
application could feed a filesharing application with the data.
Adding the TigerTree hash of the chunk will ensure the data integrity.

Obviously, the hash tree need to be done from Tiger hashes for compatibility
with gnutella servent and the new versions of eMule (for the eDonkey
network).

I would like to see a P2P program that can download from the binary
newgroups a file and, when a post or more are missing searching in the
Gnutella Network for the missing parts. Then reposting them on their ISP's
newsserver for the other nodes.
This will help much to compensate the differences from Upload and Download
capacity in the common P2P networks.
And the big files posted on binary newsgroups will be available to people
without subscribed newsservers.

Enought rant for today

Mirco





Re: xBin library version 0.1
#64781
Author: Chris AtLee
Date: Tue, 08 Apr 2003 17:40
39 lines
3201 bytes
On Tue, 08 Apr 2003 16:42:57 +0000, Mirco Romanato wrote:
> Your work is very interesting.
> I'm now are documenting myself about nntp binary posting, utility and source
> code.
> This because I want to code a plug-in for Shareaza (www.shareaza.com) when
> the plug-in SDK will be published.
> The plug-in is aimed to integrate the binary newsgroups distributions
> channel with the P2P Gnutella network.
> Apparently to integrate the two network is needed that the posts with a
> binary file chunk have:
> 1) the SHA1 hash of the original file
> 2) the TigerTree hash (TTH) of the chunk (chunks are better with a size of
> 1024*2^N bytes with N from 0 to 10)
> 3) the starting and ending points of the chunk in the file and maybe(for
> cosmetical reason mainly) the size of the file

Hmm, I'm not sure how easy it would be to merge the two together right
now.  Currently xBin does have a SHA1 hash that represents the entire
file, but it is not created just by applying the SHA1 algorithm to the
entire file at once.  Hashes for chunks of data are created, and then
those hashes are combined in a way to form a binary tree.  The root hash
is the one that represents the file.  This is done so that it is possible
to verify that one individual post is a valid part of the entire file by
specifying only part of the hash tree.  Not that it's difficult at all to
include another header specifying the SHA1 hash for the entire file.

xBin also doesn't include the hashes of the data it contains in the
headers anywhere, since those can be computed from the data itself (and
indeed should be computed from the data if you don't trust that the post
is genuine).  However, xBin does specify which chunk(s) the article does
contain in the headers, so it is possible for newsreaders to grab only the
articles it needs.

Interesting concept though!  You may want to wait and see if Curt Welch
has any comments on this, since xBin is really his baby.

Cheers,
Chris
Re: xBin library version 0.1
#64782
Author: Chris AtLee
Date: Tue, 08 Apr 2003 18:19
33 lines
2859 bytes
Just finished reading some of the documentation on Tiger Tree Hashes, and
it looks like they're exactly what xBin does with SHA1 hashes, except with
a different hashing algorithm.  They also include an extra byte of input
when combining internal nodes in the tree (in order to protect against
collisions).  The docs also mention that the name for this type of tree is
a Merkle Hash Tree.

The stated advantages of the Tiger hash over the SHA1 hash are that it is
equal to the SHA1 hash on a 32bit processor in terms of speed, and can be
faster on 16bit or 64bit platforms.  The Tiger hash produces 192 bits of
output, but they claim that even a truncated 160 bit version is more
secure than a SHA1 hash.
http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html (hash
algorithm)
http://www.open-content.net/specs/draft-jchapweske-thex-02.html (merkle
hash tree algorithm and tree exchange specification)

They recommend a block size of 1,024 bytes, but the algorithm will work
with any size you want.  There is no mention of only including the
complement of the hash tree with the data portion, it looks like they
recommend to include the entire hash tree with every portion of data.

Base32 is used in the tree exchange specification as opposed to Base64
that has been used when talking about xBin.  Not a huge deal to overcome.

So basically, in order to get an xBin post compatible with these P2P
networks, the hashing algorithm used would need to be slightly different,
would have to include the SHA1 hash of the entire file, and possibly
change the block sized used.

Cheers,
Chris
Re: xBin library version 0.1
#64783
Author: Mirco Romanato
Date: Tue, 08 Apr 2003 18:58
14 lines
1401 bytes
Chris AtLee wrote:
> Interesting concept though!  You may want to wait and see if Curt
> Welch
> has any comments on this, since xBin is really his baby.

Thanks.
I will wait.
Any comment will be useful, because I really a newcomer to the Programming
Side.

Mirco


Re: xBin library version 0.1
#64785
Author: Rene
Date: Tue, 08 Apr 2003 22:55
53 lines
3397 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote:
> The have an utility called bitcollider with available sources for compute
> SHA1, TTH, e2K hashes (MD5 based for edonkey2000 and eMule) and UUhashes

Little detail, edonkey2000 and company use MD4 not MD5.

> Obviously, the hash tree need to be done from Tiger hashes for
> compatibility with gnutella servent and the new versions of eMule (for
> the eDonkey network).

I haven't been following the late progressions of the edonkey clients, but
a new hash algorithm there not only makes no sense, it would also break
compatibility with all clients that are around. eDonkey and co don't use
the hash for more than identifying and finding files and verifying chunks
(a 9MB block).

> I would like to see a P2P program that can download from the binary
> newgroups a file and, when a post or more are missing searching in the
> Gnutella Network for the missing parts. Then reposting them on their
> ISP's newsserver for the other nodes.

Uh that could be dangerous ! (The reinjection of missing parts back to
usenet) Consider the situation where a file download was started from a
newsserver but was incomplete and completed elsewere. Now you upload the
missing parts back to the newsserver. You and 300 other people using the
same software ! So you start injecting massive duplicates (except if the
datablock's hash form an unique MID so that no server will ever get the
same block more than once. But that is another path that is dangerous to
take)

Another problem is that it is not uncommon of a server to have a file
incomplete while others have it perfeclty complete (due to rentention, for
example, a server might have already discarded parts of a file). If you now
reinject there, the other servers with more retention will recieve a block
of data which is superfluous for them - a useless duplicate. And this
"eats" into their retention, making matters worse.

> This will help much to compensate the differences from Upload and
> Download capacity in the common P2P networks.

Yeah, but the system of newsservers works very differently. It has an
entirely different architecture and following that, other problems and
other benefits.

> And the big files posted on binary newsgroups will be available to people
> without subscribed newsservers.

That's already possible today, as far as I know :)

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB
Re: xBin library version 0.1
#64786
Author: Rene
Date: Tue, 08 Apr 2003 23:02
29 lines
2389 bytes
"Chris AtLee" <catlee@canada.com> wrote:
> Just finished reading some of the documentation on Tiger Tree Hashes, and
> it looks like they're exactly what xBin does with SHA1 hashes, except
> with a different hashing algorithm.  They also include an extra byte of
> input when combining internal nodes in the tree (in order to protect
> against collisions).  The docs also mention that the name for this type
> of tree is a Merkle Hash Tree.

Yep, the xBin hash tree *is* a Merkle Hash Tree. This data structure used
in that way was invented by some guy named Merkle for the first time. AFAIK
Curt found the same solution to the same problem and simply called it hash
tree.

If I'm not mistaken the Merkle Hash Tree is described in the book "Applied
Cryptograhpy" (don't have it around me right now though so I can't check)

> They recommend a block size of 1,024 bytes, but the algorithm will work
> with any size you want.  There is no mention of only including the
> complement of the hash tree with the data portion, it looks like they
> recommend to include the entire hash tree with every portion of data.

Yes, which makes it quite a lot of meta data to send in one try. But they
only send the whole tree once and then "stream" the datablocks trough, or
something like that.

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB
Re: xBin library version 0.1
#64788
Author: Bas Ruiter
Date: Tue, 08 Apr 2003 23:57
19 lines
1836 bytes
> Yep, the xBin hash tree *is* a Merkle Hash Tree. This data structure used
> in that way was invented by some guy named Merkle for the first time. AFAIK
> Curt found the same solution to the same problem and simply called it hash
> tree.

Actually it was myself who described the method in this NG after
enquiring in sci.crypt about a good way of protecting posted files. The
enquiry was made as a result of us here sitting round trying to think of
a good way to do this. Curt then put together some test code and called
it xBin.


--
 Bas Ruiter

 e-Mail: lordsnow@home.nl
 www:    http://members.home.nl/lordsnow
Re: xBin library version 0.1
#64794
Author: Rene
Date: Wed, 09 Apr 2003 07:51
19 lines
1886 bytes
Bas Ruiter <lordsnow@home.nl> wrote:
> > Yep, the xBin hash tree *is* a Merkle Hash Tree. This data structure
> > used in that way was invented by some guy named Merkle for the first
> > time. AFAIK Curt found the same solution to the same problem and simply
> > called it hash tree.
>
> Actually it was myself who described the method in this NG after
> enquiring in sci.crypt about a good way of protecting posted files. The
> enquiry was made as a result of us here sitting round trying to think of
> a good way to do this. Curt then put together some test code and called
> it xBin.

Ah sorry for that, that was before I read this NG. I wasn't really sure
about it, which is why I wrote AFAIK above.

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB
Re: xBin library version 0.1
#64799
Author: Curt Welch
Date: Wed, 09 Apr 2003 22:02
51 lines
3849 bytes
Rene <invalid@email.addr> wrote:
> Bas Ruiter <lordsnow@home.nl> wrote:
> > > Yep, the xBin hash tree *is* a Merkle Hash Tree. This data structure
> > > used in that way was invented by some guy named Merkle for the first
> > > time. AFAIK Curt found the same solution to the same problem and
> > > simply called it hash tree.
> >
> > Actually it was myself who described the method in this NG after
> > enquiring in sci.crypt about a good way of protecting posted files. The
> > enquiry was made as a result of us here sitting round trying to think
> > of a good way to do this. Curt then put together some test code and
> > called it xBin.
>
> Ah sorry for that, that was before I read this NG. I wasn't really sure
> about it, which is why I wrote AFAIK above.

I actually "invented" the hash tree solution first here in a post.  Bas
either didn't read that post or didn't understand how good of a soultion
the idea was.  It was a huge thread.  I had not heard about Merkle hash
trees and just ended up re-enventing the wheel as we looked for a solution
to the problem of proving that a single article was in fact part of the
file we wanted.

My solution was posted in <20021004131957.981$Cz@newsreader.com> on
10-4-2002.  You can see my thought processes in the message if you look it
up on Google.  The thread was [FNTP] 'in-completeness'.

Bas posted his question to scr.crypt a few days later around 10-8, and
after having the guys there suggest and explain the idea of the hash tree
to him, he reposted the solution to news.software.nntp on 10-9.  Because he
had x-no-archvie set you can't find his post on Google.  You can find the
rest of the thread however. It was: [FNTP] verifying that part reposts
belong to a file - solution.

It was in a post in that same "solution" thread on 10-10 that I picked the
name "xBin" and pointed out that I had grabed the xbin.org domain name.

My orginal solution was to hash blocks of hash values which made it an
N-way hash tree instead of a binary hash tree.  Using a value of 2 for N is
best because it minimizes the number of hash values you must include with
each post to veryify the data.

After some more research on the net, I found that these hash trees were
known as "Merkle hash trees" because of a crypto paper published by Ralph
Merkle in 1980.  I posted that information on 10-14, in
<20021013200534.897$uo@newsreader.com>.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64800
Author: Curt Welch
Date: Wed, 09 Apr 2003 23:14
115 lines
7488 bytes
"Chris AtLee" <catlee@canada.com> wrote:
> Just finished reading some of the documentation on Tiger Tree Hashes, and
> it looks like they're exactly what xBin does with SHA1 hashes, except
> with a different hashing algorithm.

Yes, they are.  TigerTree uses 1K blocks with the 192 bit Tiger hash.

> They also include an extra byte of
> input when combining internal nodes in the tree (in order to protect
> against collisions).

??? what are you talking about?  I haven't seen anything like that in the
definitions I've read.  Where does the extra byte come from?

> The docs also mention that the name for this type
> of tree is a Merkle Hash Tree.

Right.

> The stated advantages of the Tiger hash over the SHA1 hash are that it is
> equal to the SHA1 hash on a 32bit processor in terms of speed, and can be
> faster on 16bit or 64bit platforms.  The Tiger hash produces 192 bits of
> output, but they claim that even a truncated 160 bit version is more
> secure than a SHA1 hash.

xBin is _not_ a "security" application.  SHA1 is many orders of magnatude
more "secure" than is already needed for this application.  Even if a
weakness or collision is found in SHA1 at some point in the future, it will
not prevent it from continuing to be used in xBin on Usenet for years and
years.  This is because data posted to Usenet will normally have a short
live-span, and a very low "value".  Even with a "weak" hash algortihgm, the
cost of producing a forged article which will trick the system will remain
high for many years. Is it worth setting up a distribted network of 1000
machines and crunching for a few months just to be able to create a single
collsion to corrupt a single usenet file post?  If someone has to work that
hard in order to post a single forged segment for a single usenet file, is
it really going to cause any problems large enough to care about for
Usenet?

And the issue with speed is a non issue for this applicaiton.  The limiting
factor by a few orders of magnature is not CPU speed but disk and network
speed.  SHA1 is already something like 100 times faster than it needs to be
in order to calculate the hash of a large file stored on a disk.  The CPU
is mostly sitting idle wating for the disk to deliver the next block.
There is nothing useful gained by switching to a "faster" hash algorithm.

A hash alogirthm with more bits however does waste more bandwidth and disk
space when you try to transmit and store these hash trees.

> http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html (hash
> algorithm)
> http://www.open-content.net/specs/draft-jchapweske-thex-02.html (merkle
> hash tree algorithm and tree exchange specification)
>
> They recommend a block size of 1,024 bytes, but the algorithm will work
> with any size you want.  There is no mention of only including the
> complement of the hash tree with the data portion, it looks like they
> recommend to include the entire hash tree with every portion of data.

xBin doesn't include the complement, it includes much less than that.  It
includes only the top level edge nodes from the complement.  Including the
entire complement would be useful, but it's a hell of a lot more data and
just can't be justified for this application.  You only need to include
enough of the hash tree to allow you to re-compute to file hash if your
goal is to verify the data in the article (which is the point of all this).

For example, if you want to post a file of 600 MB and use a block size of
32K, you have about 38,000 hash values in the entire hash tree.  If you
post with 600KB articles, the hash tree for only the data in the on article
is around 40 hash values.  That makes the complement tree about 37,960 hash
values.  With SHA1 hashes, that's about 750KB of hash data (in binary
form).  Posting 750KB of hash data with each 600 KB chunk of file just
won't work.  Using a tiger hash would add another 150KB of hash data to the
problem.

For the above example, the hash tree depth is about 16 so the max number of
hash values we need is roughly that plus the depth of the hash tree for the
single article (about 6), so we only need to include around 22 hash values
for each article instead of 38,000 hash values.

> So basically, in order to get an xBin post compatible with these P2P
> networks, the hashing algorithm used would need to be slightly different,
> would have to include the SHA1 hash of the entire file, and possibly
> change the block sized used.

Switching to a tree hash which matches multple P2P networks can be of
value.  But so far, from what I've seen, there really isn't a standard
there.  Each network that has used hash trees seem to have picked a
different standard. Maybe they should change to match xBin? :)

There is also a hash standard called "bitprint" (if I remeber correctly)
which was created for use in P2P networks.  It seems to be a standard
without a home (much like xBin).  If I remeber, it's a tiger hash combined
with an SHA1 hash.  This ends up creating a "huge" (192+120 bit) file hash
used to identify files.  Only the tiger-hash part would be useful in
veryifying file segments.

I really don't know much about the state of P2P networks, so I'm game to
hear more about it.  I don't think there's a lot of value trying to tie the
P2P network into Usenet in any automated fashion - and there are many
dangers in any approach that does that.  But, there are other good reasons
for sharing a common "file ID" system between usenet and other networks.
It means for example that a web site which lists files posted to Usenet
and/or P2P networks can use the same file-id to identify the file.  This
allows the web site to automatically identify files posted to both places
so it can let people know that the same file can be found on both networks.
There would be a lot of advantage for users to have access to tools which
could download part of a file from Usenet, and the rest from some P2P
network.  Or, to just use the P2P network to repost missing parts assumming
the P2P nework is smart enough to support partial file posts and fetches.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64801
Author: Bas Ruiter
Date: Thu, 10 Apr 2003 00:41
17 lines
1748 bytes
> I actually "invented" the hash tree solution first here in a post.  Bas
> either didn't read that post or didn't understand how good of a soultion
> the idea was.

Darn, I must have overlooked yor earlier post. And here was me thinking
all the time I was somewhat instrumental to the coming about of xBin
*laughs*

Ah well :)

--
 Bas Ruiter

 e-Mail: lordsnow@home.nl
 www:    http://members.home.nl/lordsnow
Re: xBin library version 0.1
#64802
Author: Curt Welch
Date: Thu, 10 Apr 2003 02:20
24 lines
2591 bytes
Bas Ruiter <lordsnow@home.nl> wrote:
> > I actually "invented" the hash tree solution first here in a post.  Bas
> > either didn't read that post or didn't understand how good of a
> > soultion the idea was.
>
> Darn, I must have overlooked yor earlier post. And here was me thinking
> all the time I was somewhat instrumental to the coming about of xBin
> *laughs*

You've been very instrumental.  Even though I might have had the idea of
using a tree of hash values a few days before you found the same answer, I
wasn't sure how secure it was.  It was your work which led us to
understanding that it was a well known and "secure" solution and helped
motivate future work which I would not likely have done on my own.  And had
you not been part of the thread before that I might well have never spent
enough time thinking about the issue to come up with the idea.  And like I
said, it was your "solution" thread that made me think these ideas needed a
name which led me to picking "xBin".  So it sure feels to me like you have
had a big part in making all this happen.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64810
Author: Mirco Romanato
Date: Thu, 10 Apr 2003 11:34
68 lines
4579 bytes
"Chris AtLee" <catlee@canada.com> ha scritto nel messaggio
news:pan.2003.04.08.18.19.33.288947@canada.com...
> The stated advantages of the Tiger hash over the SHA1 hash are that it is
> equal to the SHA1 hash on a 32bit processor in terms of speed, and can be
> faster on 16bit or 64bit platforms.  The Tiger hash produces 192 bits of
> output, but they claim that even a truncated 160 bit version is more
> secure than a SHA1 hash.
> http://www.cs.technion.ac.il/~biham/Reports/Tiger/tiger/tiger.html (hash
> algorithm)
> http://www.open-content.net/specs/draft-jchapweske-thex-02.html (merkle
> hash tree algorithm and tree exchange specification)

I will not push too much the security side, because SHA1 is secure enought
for now (as Tiger) and we can not say when a breakthroug will happen in
cryptography that make obsolete SHA1 and Tiger.
This is the rationale of using two different hashes fro different family of
algoritms.
The chance that either hash will be broken in the same time is many time
smaller than the chance a single hash is broken.
This is because bitprint use SHA1 and TTH.

> They recommend a block size of 1,024 bytes, but the algorithm will work
> with any size you want.  There is no mention of only including the
> complement of the hash tree with the data portion, it looks like they
> recommend to include the entire hash tree with every portion of data.
If you read TigerTree hash don't be fooled from the name, this must be red
like TigerTree [root] hash.
When you start downloading a file you request the TigerTree hash tree
complete for the last N levels (N=1 only the root, N=2 3 hashes, etc.)
Then you can  validate the tree computing the hashes of the single chunks
and checking the root value. If they are the same, the tree of hashes is
validated.
There is no need to transfer the entire tree any time you transfer a chunk
of data.
And you can limit the number of level of the tree to accomodate the size of
the chunk.
If a post is 512 KBytes you can have only one TT hash (the hash of the
computed 512 hashes of 1024 bytes chunks) or you can decide to transfer in
the header only two additional (total 3 hashes) describing the binary data
and check the two 256 kbytes chunk.
If you are really paranoid, you can include the TT hash of the chunk of file
(for checking for corruption in the payload) and ONE additional hash for
every level of the TigerTree tree. These hashes are the hashes computed with
the resulting hash in the next level.
So you can check the correctness of the tree.
So, a file from 512 MBs+1byte to 1024 MBs will need 13 hashes only to check
if a chunk of 512 KBytes fit in the file described from the hash (1 root
hash, 1 hash for every level (11) and the hash of the chunk).
So 512 KBytes will need additional 312 Bytes of data.
To describe the chunk you need around 2,3% of the chunks size, but there is
no point to describe a file to a so fine detail (1024 bytes chunks), you can
opt to describe only chunks of 64 KBytes or more, so you need only 192
additional bytes.
All this is less than 512 bytes for a chunk of 512 KBytes from a file of 1
GB.
For 1 TB file with chunks of 512 KB described to a detail of 64 KB you will
need 744 bytes.

English is not my native language, so if there is some point difficult to
understand please tell me.

Mirco





Re: xBin library version 0.1
#64811
Author: Mirco Romanato
Date: Thu, 10 Apr 2003 11:34
62 lines
3908 bytes
"Rene" <invalid@email.addr> ha scritto nel messaggio
news:20030408185529.861$tl@newsreader.com...
> "Mirco Romanato" <painlord2k@yahoo.it> wrote:
> > The have an utility called bitcollider with available sources for
compute
> > SHA1, TTH, e2K hashes (MD5 based for edonkey2000 and eMule) and UUhashes
> Little detail, edonkey2000 and company use MD4 not MD5.
Yes.
And this is a shame, because MD4 is very easy to forge (1 seconds on normal
PC?)

> I haven't been following the late progressions of the edonkey clients, but
> a new hash algorithm there not only makes no sense, it would also break
> compatibility with all clients that are around. eDonkey and co don't use
> the hash for more than identifying and finding files and verifying chunks
> (a 9MB block).
The new veersion of eMule will implement TigerTree hash tree.




> Uh that could be dangerous!
I understand it!
Powerful things are always very dungerous if don't use properly.

> (The reinjection of missing parts back to
> usenet) Consider the situation where a file download was started from a
> newsserver but was incomplete and completed elsewere. Now you upload the
> missing parts back to the newsserver. You and 300 other people using the
> same software ! So you start injecting massive duplicates (except if the
> datablock's hash form an unique MID so that no server will ever get the
> same block more than once. But that is another path that is dangerous to
> take)
For this problem, I think that is like having people to request reposts.
If a node retrieve a missing part via P2P, it can repost it from its news
server after a random time (say from 0 seconds from 1 day or maybe 1 week)
and after checking that the missing part is not there before starting to
post.


> Another problem is that it is not uncommon of a server to have a file
> incomplete while others have it perfeclty complete (due to rentention, for
> example, a server might have already discarded parts of a file). If you
> now reinject there, the other servers with more retention will recieve a
> block of data which is superfluous for them - a useless duplicate. And
> this "eats" into their retention, making matters worse.
This is a problem that is common with manual reposts.


> > This will help much to compensate the differences from Upload and
> > Download capacity in the common P2P networks.
> Yeah, but the system of newsservers works very differently. It has an
> entirely different architecture and following that, other problems and
> other benefits.
This is because I think this application will best used to rapid
distribution of very popular files, like linux ISOs.

Mirco


Re: xBin library version 0.1
#64812
Author: Mirco Romanato
Date: Thu, 10 Apr 2003 11:34
22 lines
2060 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030409191413.445$rS@newsreader.com...

> For example, if you want to post a file of 600 MB and use a block size of
> 32K, you have about 38,000 hash values in the entire hash tree.  If you
> post with 600KB articles, the hash tree for only the data in the on
article
> is around 40 hash values.  That makes the complement tree about 37,960
> hash
> values.  With SHA1 hashes, that's about 750KB of hash data (in binary
> form).  Posting 750KB of hash data with each 600 KB chunk of file just
> won't work.  Using a tiger hash would add another 150KB of hash data to
> the problem.

I confuted this in another post in this tread. No more than 1KBytes of data
is need even the original file is 1 TB and the chunks are 512 Kbytes.

Mirco


Re: xBin library version 0.1
#64822
Author: Chris AtLee
Date: Thu, 10 Apr 2003 18:15
151 lines
9320 bytes
On Wed, 09 Apr 2003 23:14:13 +0000, Curt Welch wrote:
> "Chris AtLee" <catlee@canada.com> wrote:
>> Just finished reading some of the documentation on Tiger Tree Hashes,
>> and it looks like they're exactly what xBin does with SHA1 hashes,
>> except with a different hashing algorithm.
> 
> Yes, they are.  TigerTree uses 1K blocks with the 192 bit Tiger hash.
> 
>> They also include an extra byte of
>> input when combining internal nodes in the tree (in order to protect
>> against collisions).
> 
> ??? what are you talking about?  I haven't seen anything like that in
> the definitions I've read.  Where does the extra byte come from?

From the Tree Hash Exchange Format document section 2.1:

http://www.open-content.net/specs/draft-jchapweske-thex-02.html#anchor3

"In order to protect against collisions between leaf hashes and internal
hashes, different hash constructs are used to hash the leaf nodes and the
internal nodes. The same hash algorithm is used as the basis of each
construct, but a single '1' byte in network byte order, or 0x01 is
prepended to the input of the internal node hashes, and a single '0' byte,
or 0x00 is prepended to the input of the leaf node hashes.

Let H() be the secure hash algorithm, for example SHA-1.

internal hash function = IH(X) = H(0x01, X)

leaf hash function = LH(X) = H(0x00, X)"

I haven't checked the source to see if tigertree hashes actually use this
or not, but this is where I got it from.

>> The docs also mention that the name for this type of tree is a Merkle
>> Hash Tree.
> 
> Right.
> 
>> The stated advantages of the Tiger hash over the SHA1 hash are that it
>> is equal to the SHA1 hash on a 32bit processor in terms of speed, and
>> can be faster on 16bit or 64bit platforms.  The Tiger hash produces 192
>> bits of output, but they claim that even a truncated 160 bit version is
>> more secure than a SHA1 hash.
> 
> xBin is _not_ a "security" application.  SHA1 is many orders of
> magnatude more "secure" than is already needed for this application.
> Even if a weakness or collision is found in SHA1 at some point in the
> future, it will not prevent it from continuing to be used in xBin on
> Usenet for years and years.  This is because data posted to Usenet will
> normally have a short live-span, and a very low "value".  Even with a
> "weak" hash algortihgm, the cost of producing a forged article which
> will trick the system will remain high for many years. Is it worth
> setting up a distribted network of 1000 machines and crunching for a few
> months just to be able to create a single collsion to corrupt a single
> usenet file post?  If someone has to work that hard in order to post a
> single forged segment for a single usenet file, is it really going to
> cause any problems large enough to care about for Usenet?
> 
> And the issue with speed is a non issue for this applicaiton.  The
> limiting factor by a few orders of magnature is not CPU speed but disk
> and network speed.  SHA1 is already something like 100 times faster than
> it needs to be in order to calculate the hash of a large file stored on
> a disk.  The CPU is mostly sitting idle wating for the disk to deliver
> the next block. There is nothing useful gained by switching to a
> "faster" hash algorithm.
> 
> A hash alogirthm with more bits however does waste more bandwidth and
> disk space when you try to transmit and store these hash trees.

The point they were claiming in the Tiger hash document was that even if
you only used 160 bits of the Tiger hash, those 160 bits were a stronger
hash than the 160 SHA1 bits, so if bandwidth was an issue, you could just
send 160 bits.  Anyway, I'm not advocating Tiger over SHA1, I was just
summarizing the differences.

>> They recommend a block size of 1,024 bytes, but the algorithm will work
>> with any size you want.  There is no mention of only including the
>> complement of the hash tree with the data portion, it looks like they
>> recommend to include the entire hash tree with every portion of data.
> 
> xBin doesn't include the complement, it includes much less than that. It
> includes only the top level edge nodes from the complement. Including
> the entire complement would be useful, but it's a hell of a lot more
> data and just can't be justified for this application.  You only need to
> include enough of the hash tree to allow you to re-compute to file hash
> if your goal is to verify the data in the article (which is the point of
> all this).

Sorry, that is what I meant.  I didn't know what to call it, so I called
it the complement.  Maybe minimal hash tree complement would be more
accurate?

>> So basically, in order to get an xBin post compatible with these P2P
>> networks, the hashing algorithm used would need to be slightly
>> different, would have to include the SHA1 hash of the entire file, and
>> possibly change the block sized used.
> 
> Switching to a tree hash which matches multple P2P networks can be of
> value.  But so far, from what I've seen, there really isn't a standard
> there.  Each network that has used hash trees seem to have picked a
> different standard. Maybe they should change to match xBin? :)
> 
> There is also a hash standard called "bitprint" (if I remeber correctly)
> which was created for use in P2P networks.  It seems to be a standard
> without a home (much like xBin).  If I remeber, it's a tiger hash
> combined with an SHA1 hash.  This ends up creating a "huge" (192+120
> bit) file hash used to identify files.  Only the tiger-hash part would
> be useful in veryifying file segments.

Yes, the bitprint is a combination of the SHA1 hash with the TigerTree
hash of a file (which is different from a tiger hash of a file - a tiger
tree hashes combines tiger hashes of 1024 bytes into a merkle hash tree;
the tiger hash itself knows nothing about trees, so it could be used on
the entire file)

> I really don't know much about the state of P2P networks, so I'm game to
> hear more about it.  I don't think there's a lot of value trying to tie
> the P2P network into Usenet in any automated fashion - and there are
> many dangers in any approach that does that.  But, there are other good
> reasons for sharing a common "file ID" system between usenet and other
> networks. It means for example that a web site which lists files posted
> to Usenet and/or P2P networks can use the same file-id to identify the
> file.  This allows the web site to automatically identify files posted
> to both places so it can let people know that the same file can be found
> on both networks. There would be a lot of advantage for users to have
> access to tools which could download part of a file from Usenet, and the
> rest from some P2P network.  Or, to just use the P2P network to repost
> missing parts assumming the P2P nework is smart enough to support
> partial file posts and fetches.

This is what caught my attention.  Sharing common "file ID"s between
usenet and other networks opens up a lot of possibilities.  In addition,
there are tools out there that let you associate meta-data with file IDs
(see the bitcollider utility at www.bitzi.com)  Having your P2P client
scan various newsgroups for files and use usenet to request and repost
missing parts is a very powerful idea.  Of course, the P2P side would need
to add on something to specify which newsgroups the files were being
posted in.

If this makes sense to include into xBin, it would mean changing the block
size to 1,024 bytes, using the TigerTree hash for verification of blocks,
and also including the SHA1 hash in the headers somewhere.  All of this means
that the xBin headers will be slightly larger since the TigerTree hash is
longer and minimal hash tree complement will be larger since the merkle
hash tree is larger.

Cheers,
Chris
Re: xBin library version 0.1
#64827
Author: Curt Welch
Date: Thu, 10 Apr 2003 21:46
187 lines
11001 bytes
"Chris AtLee" <catlee@canada.com> wrote:
> On Wed, 09 Apr 2003 23:14:13 +0000, Curt Welch wrote:
> > "Chris AtLee" <catlee@canada.com> wrote:

> > ??? what are you talking about?  I haven't seen anything like that in
> > the definitions I've read.  Where does the extra byte come from?
>
> From the Tree Hash Exchange Format document section 2.1:
>
> http://www.open-content.net/specs/draft-jchapweske-thex-02.html#anchor3
>
> "In order to protect against collisions between leaf hashes and internal
> hashes, different hash constructs are used to hash the leaf nodes and the
> internal nodes.

Very odd.  I have no idea why they think 1) doing that will protect against
collisions, and 2) why that is useful.

I had scanned that web page before but didn't read it careful enough to
notice that.

Does anyone see _any_ point in doing that?

The section is under the description of Merkle Hash Trees so maybe this was
an idea that Merkle added in his original paper?

> I haven't checked the source to see if tigertree hashes actually use this
> or not, but this is where I got it from.

I've looked at some TigerTree code and didn't notice it doing anything like
that.  But, I might have missed it just like I did when I read the above
document because I didn't expect it to be there.

> The point they were claiming in the Tiger hash document was that even if
> you only used 160 bits of the Tiger hash, those 160 bits were a stronger
> hash than the 160 SHA1 bits, so if bandwidth was an issue, you could just
> send 160 bits.  Anyway, I'm not advocating Tiger over SHA1, I was just
> summarizing the differences.

Yeah, I wonder how they can justify that claim.

> Sorry, that is what I meant.  I didn't know what to call it, so I called
> it the complement.  Maybe minimal hash tree complement would be more
> accurate?

Yeah, I have no idea what to call it either.  When we put those hash values
in a header we couldn't figure out what to name the header either.

> Yes, the bitprint is a combination of the SHA1 hash with the TigerTree
> hash of a file (which is different from a tiger hash of a file - a tiger
> tree hashes combines tiger hashes of 1024 bytes into a merkle hash tree;
> the tiger hash itself knows nothing about trees, so it could be used on
> the entire file)

Your wording is a bit odd there.  You say "so it could be used on the
entire file".  What is your point?

A tiger tree hash is a hash just like a tiger hash is a hash and SHA-1 is a
hash.  They are all used on the entire file to produce a single file hash.
The SHA-1 hash of a file is a 120 bit value, an Tiger hash of a file is a
192 bit value, a Tiger Tree Hash of a file is also a 192 bit value.

The advantage of any tree hash is that you can veryify that any block (in
the hash block size) is in fact part of the file with hash X, without
having access to the rest of the file.  You only need access to a small set
of internal hash values (nodes from the tree) to recompute the file hash.
The non-tree hashes, like SHA-1 and Tiger, don't allow you to do that.  If
you have a single block of the file, the only way to know if it's truelly
part of the file with hash XYZ, is to get access to the entire file.

Another post on this thread said something like "the tiger hash of the
segment".  That's a totaly bogus statement.  Is someone confused here?

> If this makes sense to include into xBin, it would mean changing the
> block size to 1,024 bytes, using the TigerTree hash for verification of
> blocks, and also including the SHA1 hash in the headers somewhere.

A big part of what we are looking at with xBin is reducing the possibilty
for abuse.  We want to be able to look at a single article (the smallest
unit of information in usenet), and veryify it's both valid, and part of
the file it claimes to be part of.  Given 10,000 articles which all claim
to be part of a given file, we need a sure-fire way to sort out the
forgeries from the real data.  Using a tree hash as the unique identifier
for a file allows us to do that.

An SHA1 file hash is worthless.  It can (and will be) forged, with no way
knowing if the SHA1 hash listed in the article has anything to do with the
data in that article.

So, my question is, why is it needed for the P2P network?  If you can not
ask the P2P network to deliver a file segment to you using only the tree
hash, then this is just not going to work.

I wonder if an issue with the P2P network designs is that they haven't been
thinking about the problem of transporting file segments instead of entire
files?  If the only way to submit data for transport to the P2P network is
to submit the entire file, then the network will always be able to
calculate and veryify the full file SHA-1 hash.  So it can use that to
identify files.  But, if like usenet, it suports the concept of submitting
only a file segment for transport, then you would be forced to "trust" the
SHA-1 value provided by the person submitting the segment, which, like on
usenet, opens the door for data polution by people submitting false data
(either intentinally or accidentially).

> All
> of this means that the xBin headers will be slightly larger since the
> TigerTree hash is longer and minimal hash tree complement will be larger
> since the merkle hash tree is larger.

Yeah, there are issues.

Because of how uuencoded multipart files are split (on uuencoded line
boundries), the current posting conventions creates segements which are a
multiple of 45 bytes (the number of bytes encoded in each uuencoded line).
To be compatible with this limitation, we (I mostly) argued that it would
be best to pick a block size for xBin which was a multiple of 45.  The
current front-runner for this is 22500 byte blocks. (500 uuencoded lines).

Picking a block size which wasn't a multiple of 45 means you either 1),
don't post any multipart files in uuencode anymore (not a huge problem
because yEnc is so wide spread for multipart posting), 2), allow the last
line for each multipart article to be shorter than the 45 byte standard
which should work (every uuencoded line has a character at the beginning
which specifies the number of bytes on the line where M means 45).

Being more compatible with current usenet practice makes the standard more
likely to suceed, but making it compatible with other standards (like P2P)
might help more than the compatibility with uuencode.

I've also had second thoughts about using a non power-of-two block size for
other future reasons and thought that maybe a 32K block size would be
better.

The next issue is that the larger the block size, the smaller the tree is,
and the less hash values you need to include with each post.  With 1K
blocks, you add 5 more levels to the hash tree than with 32K blocks, which
means you can add up to 10 more hash values to every post.

For usenet, we really need to put these hash values in the header, not in
the body.  We need to add this hash data to the posts in a way that won't
break current decoders.  With yEnc, because there's a begin and end marker
in every article, it would be straight forward to define a text format for
the hash data which was placed in the body, but outside the yEnc data in
the article.  Current yEnc decoders would just ignore it.  With uuencode
however, there are no begin and end markers on each article, so adding any
extra text in the body is likely to break some decoders.  You might be able
to make it work because most decoders already have logic to ignore
signatures added by some servers to all posts, so maybe hiding the hash
data in a signature at the end of the body would work.

But, putting the hash data in the headers would work for sure in terms of
not breaking current usenet decoders.  And, on top of that, having it in
the header allows clients to fetch the hash tree data with HEAD commands
without having forceing them to fetch the entire body.  There are various
applications were this would be useful.

However, with SHA1 hashes, and 22500 byte blocks, the amount of hash data
is already approaching the limits of how much data you can safely put into
the header without running into line length or header length limits which
exist on some current servers.

For a 1GB file, with 512KB per aritcle, and a 32KB hash block size, you are
talking about needing around 19 hash values per article.  With 1KB hash
block sizes, you add about 10 hashes to that bringinging it to 29 hash
values.

If you make it a tigertree hash as well with 24 bytes per hash instead of
20, you are talking about 696 bytes of hash data instead of 19*20 or 380
bytes so swtiching from the type of system we are looking at for the
current xBin to TigherTree would come close to doubling the amount of hash
data we are trying to stuff into the headers for a typical "large" file of
today.  So that's yet another issue to weigh when looking at this
decission.  There are options for butting that much data into the header,
but it causes problems which could make the standard harder for usenet as a
whole to accept.

The hash block size also sets the minimum size of a multipart post.  People
sometimes flood groups with 1000 part multipart posts which only have 2
lines of uuencoded data per article.  Having a large minimum size (32K vs
1K) is also seen as an advantage to make some types of abuse like this easy
and natural to filter at the source.  This however I don't see as important
at the other issues.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64828
Author: Chris AtLee
Date: Thu, 10 Apr 2003 22:55
132 lines
8140 bytes
On Thu, 10 Apr 2003 21:46:00 +0000, Curt Welch wrote:
> "Chris AtLee" <catlee@canada.com> wrote:
>> On Wed, 09 Apr 2003 23:14:13 +0000, Curt Welch wrote:
>> > "Chris AtLee" <catlee@canada.com> wrote:
>> "In order to protect against collisions between leaf hashes and
>> internal hashes, different hash constructs are used to hash the leaf
>> nodes and the internal nodes.
> 
> Very odd.  I have no idea why they think 1) doing that will protect
> against collisions, and 2) why that is useful.
> 
> I had scanned that web page before but didn't read it careful enough to
> notice that.
> 
> Does anyone see _any_ point in doing that?
> 
> The section is under the description of Merkle Hash Trees so maybe this
> was an idea that Merkle added in his original paper?
> 
>> I haven't checked the source to see if tigertree hashes actually use
>> this or not, but this is where I got it from.
> 
> I've looked at some TigerTree code and didn't notice it doing anything
> like that.  But, I might have missed it just like I did when I read the
> above document because I didn't expect it to be there.

I just checked, and they don't do anything like this.

>> Yes, the bitprint is a combination of the SHA1 hash with the TigerTree
>> hash of a file (which is different from a tiger hash of a file - a
>> tiger tree hashes combines tiger hashes of 1024 bytes into a merkle
>> hash tree; the tiger hash itself knows nothing about trees, so it could
>> be used on the entire file)
> 
> Your wording is a bit odd there.  You say "so it could be used on the
> entire file".  What is your point?

In your previous post you said:
> There is also a hash standard called "bitprint" (if I remeber correctly)
> which was created for use in P2P networks.  It seems to be a standard
> without a home (much like xBin).  If I remeber, it's a tiger hash
> combined with an SHA1 hash.  This ends up creating a "huge" (192+120
> bit) file hash used to identify files.  Only the tiger-hash part would
> be useful in veryifying file segments.

I just wanted to clarify that there was a difference between a tiger-hash
of a file and a tiger-tree-hash of a file.

>> All
>> of this means that the xBin headers will be slightly larger since the
>> TigerTree hash is longer and minimal hash tree complement will be
>> larger since the merkle hash tree is larger.
> 
> Yeah, there are issues.

<snip>

> For usenet, we really need to put these hash values in the header, not
> in the body.  We need to add this hash data to the posts in a way that
> won't break current decoders.  With yEnc, because there's a begin and
> end marker in every article, it would be straight forward to define a
> text format for the hash data which was placed in the body, but outside
> the yEnc data in the article.  Current yEnc decoders would just ignore
> it.  With uuencode however, there are no begin and end markers on each
> article, so adding any extra text in the body is likely to break some
> decoders.  You might be able to make it work because most decoders
> already have logic to ignore signatures added by some servers to all
> posts, so maybe hiding the hash data in a signature at the end of the
> body would work.

<snip>

> But, putting the hash data in the headers would work for sure in terms
> of not breaking current usenet decoders.  And, on top of that, having it
> in the header allows clients to fetch the hash tree data with HEAD
> commands without having forceing them to fetch the entire body.  There
> are various applications were this would be useful.

Hmm, I hadn't thought that the hash data would be useful without the
article data...The root hash (or part of it) needs to be in the headers so
that clients can quickly find articles with HEAD commands, but why would
having the "minimal hash tree complement" in the headers be necessary? You
can't tell if it's valid or not unless you download the entire article.

> However, with SHA1 hashes, and 22500 byte blocks, the amount of hash
> data is already approaching the limits of how much data you can safely
> put into the header without running into line length or header length
> limits which exist on some current servers.
> 
> For a 1GB file, with 512KB per aritcle, and a 32KB hash block size, you
> are talking about needing around 19 hash values per article.  With 1KB
> hash block sizes, you add about 10 hashes to that bringinging it to 29
> hash values.
> 
> If you make it a tigertree hash as well with 24 bytes per hash instead
> of 20, you are talking about 696 bytes of hash data instead of 19*20 or
> 380 bytes so swtiching from the type of system we are looking at for the
> current xBin to TigherTree would come close to doubling the amount of
> hash data we are trying to stuff into the headers for a typical "large"
> file of today.  So that's yet another issue to weigh when looking at
> this decission.  There are options for butting that much data into the
> header, but it causes problems which could make the standard harder for
> usenet as a whole to accept.

If it does have to go in the headers, you could always split it up into
Content-Merkle-Tree1, Content-Merkle-Tree2, etc.  How big can a header be?
 Are headers 8-bit clean?  Otherwise multiply your above figures by 1.33
for base64 encoding.

> The hash block size also sets the minimum size of a multipart post. 
> People sometimes flood groups with 1000 part multipart posts which only
> have 2 lines of uuencoded data per article.  Having a large minimum size
> (32K vs 1K) is also seen as an advantage to make some types of abuse
> like this easy and natural to filter at the source.  This however I
> don't see as important at the other issues.

You could restrict xBin posts to some multiple of 1K, but still use 1K as
the hash block size.  In addition, restricting xBin posts to some power of
2 multiple of 1K, like 32K, would make the "minimal hash tree complement"
much smaller since you'd be guaranteeing that the bottom 5 rows (in this
example) of the partial tree computed from the article data would be
complete, therefore you wouldn't need to include anything below row 5 in
the minimal tree complement.  (How's that for a run on sentence?)  So you
could define an "xBin block" to be 32678 bytes, the size and offset values
in the Message-ID header would use this block size to count, which would
in effect restrict the posts to use that block size.  Still, the last post
of the file may have too many hashes to include in the header since it
wouldn't necessarily be a multiple of 32K...

Cheers,
Chris
Re: xBin library version 0.1
#64847
Author: Peter Robinson
Date: Sat, 12 Apr 2003 10:58
21 lines
2075 bytes
Curt Welch <curt@kcwc.com> wrote:

> the current posting conventions creates segements which are a
> multiple of 45 bytes (the number of bytes encoded in each uuencoded line).
> To be compatible with this limitation, we (I mostly) argued that it would
> be best to pick a block size for xBin which was a multiple of 45.  The
> current front-runner for this is 22500 byte blocks. (500 uuencoded lines).

Where did the 500 come from?

> I've also had second thoughts about using a non power-of-two block size for
> other future reasons and thought that maybe a 32K block size would be
> better.

I haven't been following all the discussion, but could you compromise
with something like 512*45 bytes (22.5KB)?  Perhaps having a block size
that's 'not quite' a power of two is no better, though.  At least 22.5KB
is a multiple of more hash 'bandwidths' (e.g. 192bit) than 22500 bytes.

Peter
Re: xBin library version 0.1
#64964
Author: Curt Welch
Date: Mon, 21 Apr 2003 15:53
60 lines
4184 bytes
"Chris AtLee" <catlee@canada.com> wrote:
> On Tue, 08 Apr 2003 16:42:57 +0000, Mirco Romanato wrote:
> > Your work is very interesting.
> > I'm now are documenting myself about nntp binary posting, utility and
> > source code.
> > This because I want to code a plug-in for Shareaza (www.shareaza.com)
> > when the plug-in SDK will be published.
> > The plug-in is aimed to integrate the binary newsgroups distributions
> > channel with the P2P Gnutella network.
> > Apparently to integrate the two network is needed that the posts with a
> > binary file chunk have:
> > 1) the SHA1 hash of the original file

How important is that really?  If we switch to useing a TTH which is
compatable with other P2P systems, do we also need to make sure the SHA1
hash is supplied in all articles or can we just ignore that?  If someone
publishes a partial file on Usenet and tells us what the SHA-1 hash of the
full file is, we can not trust what they tell us because we have no way to
verify it.

However, like this size problem I've posted about, you could define the
xBin file-id hash to be built by hashing both the file data, and the total
file size, and the file SHA-1 hash all together.  We can then verify that
the SHA-1 value is consistent with the xBin hash, but now with the TTH
hash.

My guess is that the SHA-1 of the file is something that can never really
be useed safely because it can't be trusted.  And if you do start to
include it and make use of it, it will simply open up a hole which will,
down the line, be abused.

> > 2) the TigerTree hash (TTH) of the chunk (chunks are better with a size
> > of 1024*2^N bytes with N from 0 to 10)
> > 3) the starting and ending points of the chunk in the file and
> > maybe(for cosmetical reason mainly) the size of the file
>
> Hmm, I'm not sure how easy it would be to merge the two together right
> now.

After all the messages on this, my current thought is that I (or someone)
has to do more research on what the current P2P protcols are actaully
using.  Exactly what TTH (or modified TTH) are they using, and what are
they doing with it. Mirco has provided a ton of intersting ideas and
pointers to work in this area but some of the important details are still
unclear in my mind.

The possible option for xBin is to switch from the current SHA-1 based hash
with block sizes optimized for Usenet only to one which is compatible with
a P2P standard.  But the need to solve the accuracy of the file size data
included in each article by hashing it along with the file data changes the
hash in a way which might prevent it from every being compatible with the
P2P standards.  But people in the P2P community saw this same problem, and
the need to make this change for P2P seemed, in the e-mail message I saw,
to create problems within the P2P work already done as it was and I don't
know know how they resolved that problem.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64970
Author: Mirco Romanato
Date: Mon, 21 Apr 2003 18:00
85 lines
4639 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030421115343.200$MS@newsreader.com...

> > > 1) the SHA1 hash of the original file
> How important is that really?  If we switch to useing a TTH which is
> compatable with other P2P systems, do we also need to make sure the SHA1
> hash is supplied in all articles or can we just ignore that?  If someone
> publishes a partial file on Usenet and tells us what the SHA-1 hash of the
> full file is, we can not trust what they tell us because we have no way to
> verify it.

Yes.
TTH is needed.
SHA-1 is desidered, but it is not needed.
Also, in gnutella the SHA-1 is checked when the file is completed (and after
TTH is checked)

SHA-1 is useful because not all gnutella clients use TTH, but all of them
use SHA-1.
But if a node using TTH have the complete file it can send out the SHA-1 of
it.


> My guess is that the SHA-1 of the file is something that can never really
> be useed safely because it can't be trusted.  And if you do start to
> include it and make use of it, it will simply open up a hole which will,
> down the line, be abused.
It can be abused only in a way.
If someone claim a file have a particular SHA-1, we can download the file
and check.
If it don't check we mark the file inaffidable and leave the users to decide
what to do.

But I only advocate using the SHA-1 with TTH and not without.




> > > 2) the TigerTree hash (TTH) of the chunk (chunks are better with a
size
> > > of 1024*2^N bytes with N from 0 to 10)
> > > 3) the starting and ending points of the chunk in the file and
> > > maybe(for cosmetical reason mainly) the size of the file
> > Hmm, I'm not sure how easy it would be to merge the two together right
> > now.

> After all the messages on this, my current thought is that I (or someone)
> has to do more research on what the current P2P protcols are actaully
> using.  Exactly what TTH (or modified TTH) are they using, and what are
> they doing with it. Mirco has provided a ton of intersting ideas and
> pointers to work in this area but some of the important details are still
> unclear in my mind.

TTH http://sourceforge.net/projects/tigertree/
here there is the standard Java and C implementation (8 days old) with tha
last fixes.
You are lucky, they must change the code 3 times in 6 months.

Bitcollider http://sourceforge.net/projects/bitcollider
with the code to near any type of hash and metadata extraction

It also have a few plug-ins to extract metadata from particular file (MP3,
PDF, etc.)

> The possible option for xBin is to switch from the current SHA-1 based
hash
> with block sizes optimized for Usenet only to one which is compatible with
> a P2P standard.  But the need to solve the accuracy of the file size data
> included in each article by hashing it along with the file data changes
the
> hash in a way which might prevent it from every being compatible with the
> P2P standards.  But people in the P2P community saw this same problem, and
> the need to make this change for P2P seemed, in the e-mail message I saw,
> to create problems within the P2P work already done as it was and I don't
> know know how they resolved that problem.

I reccoment to use the project above like standards, because they are used
like standards for Gnutella (and eMule).
I think others network will use the same code in future, because it work
well.

Mirco


Re: xBin library version 0.1
#64975
Author: Curt Welch
Date: Tue, 22 Apr 2003 00:12
32 lines
2745 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote:
> TTH http://sourceforge.net/projects/tigertree/
> here there is the standard Java and C implementation (8 days old) with
> tha last fixes.
> You are lucky, they must change the code 3 times in 6 months.

The only difference I spot in that code is that they prepend a 0 valued
byte to the leaf blocks (so that makes it 1025 bytes to hash) before
calculating the hash for the block, and a 1 valued byte in front of the two
hash values for each of the nodes.  This is the stuff you pointed out
before which I didn't understand and we decided wasn't in the tigertree
code we had seen.  It prevents the construnction of obvious collisions by
simply creating a file which contins the two hash values from the top node
of the hash tree.

It does notthing to solve the file size problem that we have with the
Usenet application of this (or which any network would have if you were
going to try and transport partial files securly though the network.

> I reccoment to use the project above like standards, because they are
> used like standards for Gnutella (and eMule).
> I think others network will use the same code in future, because it work
> well.

Unfortunately, they have missed the file size problem when you try to
securely transport partial file segments and don't submit the entire file
to the network for transport.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64977
Author: Mirco Romanato
Date: Tue, 22 Apr 2003 09:40
14 lines
1713 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030421201204.318$Ng@newsreader.com...

> Unfortunately, they have missed the file size problem when you try to
> securely transport partial file segments and don't submit the entire file
> to the network for transport.

I asked today on the Bitzi forum for developers.
If there is an answer I will tell you about.

Mirco


Re: xBin library version 0.1
#64988
Author: Mirco Romanato
Date: Wed, 23 Apr 2003 13:55
28 lines
2240 bytes
"Mirco Romanato" <painlord2k@yahoo.it> ha scritto nel messaggio
news:068pa.56793$iy5.1710568@twister2.libero.it...
> "Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
> news:20030421201204.318$Ng@newsreader.com...

> > Unfortunately, they have missed the file size problem when you try to
> > securely transport partial file segments and don't submit the entire
file
> > to the network for transport.

> I asked today on the Bitzi forum for developers.
> If there is an answer I will tell you about.

Just now, I think, could be used the TigerTree like it is now.

Shareaza have this problem, with different TTH code in different versions of
the client 1.8.00 - 1.8.0.20.

It used a version number for the TTH in the N2R conversion when there is a
request for the file.

This could be done in Xbin standard, so it will let different version to
cooperate, in case bugs are finded and corrected.

Mirco


Re: xBin library version 0.1
#64989
Author: Mirco Romanato
Date: Wed, 23 Apr 2003 15:21
99 lines
5470 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030421201204.318$Ng@newsreader.com...

> Unfortunately, they have missed the file size problem when you try to
> securely transport partial file segments and don't submit the entire file
> to the network for transport.

I posted to the Bitzi board to have info about your issue.
This is the reply by Gordon Mohr <gojomo@yahoo.com>
I have a very high respect for the skill and knowledge of Gordon in the
cryptographic area, and I trust his reply and his opinion.
If this don't solve your doubts about using the TigerTree hash, I advice you
to subscribe to the http://zgp.org/mailman/listinfo/p2p-hackers and raise
the issue.
There are many experts that can solve your doubts in the list, and give good
advices.





Posted by:  gojomo <http://bitzi.com/bitizen/gojomo>

Thanks for bringing this conversation to our attention.

FYI, the TigerTree algorithm has only been changed once in its
history, earlier this year, to address the "trivial missized
collision" issue that was first brought to our attention last
November. We made the change after consulting with a number of
cryptographic experts as to the best solution. The THEX specification
was updated in March, and the code in the 'tigertree' and
'bitcollider' projects at Sourceforge since then.

I don't quite know what Curt Welch means by "the file size problem"
that he believes remains, and browsing over more of the conversation
at news.software.nntp hasn't helped me understand.

TigerTree (or other THEX tree-arranged hash) should be ideal for the
issue of Usenet posts split into many parts. If it is necessary to
know exactly where a part fits into the whole, and the size of the
whole, with every part, then you should include (a portion of) the
full tree with each part.

That portion could be (1) all generations of the serialized tree from
the node which includes the sent part on up to the root (in which case
you could use the THEX serialized form); or (2) all the nodes in the
same generation as the node which includes the sent part; or (3) an
even more compact "proof", which only contains the barest minimum
other node values to "paint in" the sent part's value, up to the root.

So considering a file broken into 8 parts, A B C D E F G H, and
assuming you're sending part C:

The tree is:


......O.......
..M...+...N...
I.+.J...K.+.L.
A+B.C+D.E+F.G+H


Under strategy (1), you'd send all interim values A B C D E F G H I J
K L M N O (the full THEX tree) along with the data for part C. The
recipient would know for certain the whole file's size, the whole
file's treehash, C's size, where C fits in, and every interim hash at
C's level and higher.

Under strategy (2), you'd send just the bottom interim values A B C D
E F G H along with the data for part C -- because I J K L M N O are
all trivially calculatable from the bottom generation. Again, the
recipient would know for certain the whole file's size, the whole
file's treehash, C's size, where C fits in, and every interim hash at
C's level and higher.

Under strategy (3), you'd only send the barest minimum of other values
to prove where C fits in -- D I N -- along with the data for C. (D
with C is enough to calculate J, J with I is enough to calculate M, M
with N is enough to calculate O.) Here, the recipient would know for
certain the whole file's size, the whole file's treehash, C's size,
where C fits in, and the interim hashes between C and the root value.

-- Even the "send the whole (top of) the tree" strategy #1 is a small
amount of overhead compared to large files: Splitting a 1GB file into
1024 1MB segments only requires a full tree of 2048 interim values,
~48K. That's under 5% overhead per 1MB part. (For strategy #2, that'd
be 1024 interim values: 24K, <2.5% overhead. For strategy #3, that'd
be just 10 interim values, 240bytes, <0.03% overhead -- but much more
complicated code as random parts come in.)

Hope this helps,

--------------------
This is a posting from the Bitzi Developer Discussion bboard.
To reply you can go to:
http://bitzi.com/bboard/message?message_id=102421&forum_id=4076#102455


Re: xBin library version 0.1
#64992
Author: Curt Welch
Date: Wed, 23 Apr 2003 21:47
310 lines
18191 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote:
> "Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
> news:20030421201204.318$Ng@newsreader.com...
>
> > Unfortunately, they have missed the file size problem when you try to
> > securely transport partial file segments and don't submit the entire
> > file to the network for transport.
>
> I posted to the Bitzi board to have info about your issue.
> This is the reply by Gordon Mohr <gojomo@yahoo.com>
> I have a very high respect for the skill and knowledge of Gordon in the
> cryptographic area, and I trust his reply and his opinion.
> If this don't solve your doubts about using the TigerTree hash, I advice
> you to subscribe to the http://zgp.org/mailman/listinfo/p2p-hackers and
> raise the issue.

I'll talk with him directly.  Or, I guess I just cc this to him and we can
talk this over in e-mail.  Or he can follow up in usenet if he likes.  He
just hasn't seen the issue I'm talking about yet.  He will.

> There are many experts that can solve your doubts in the list, and give
> good advices.
>
> Posted by:  gojomo <http://bitzi.com/bitizen/gojomo>

> I don't quite know what Curt Welch means by "the file size problem"
> that he believes remains, and browsing over more of the conversation
> at news.software.nntp hasn't helped me understand.

Let me explain the "file size" problem...

We are trying to create a system where you can examine a single Usenet
article which contians a portion of a file and know for a fact that all the
information you have about that chunk is valid.  We need to do this because
people at times have actively tried to post fake articles in an attempt to
prevent files from being transfered over Usenet.

Right now, this act of corrupting a mutipart file post is trivial.  Parts
are matched up right now simply by subject.  To post fake data into the
middle of a post, all you need to do is put bogus data in an article with
the correct subject.  This alone is enough to break far too many of the
currend download tools.  However, most downloads on usenet are not done
automatically today.  It's all semi-automatic.  Most the time, the user is
shown a list of articles, and they have the power to spot things that don't
look right and fix them.

Also, large files are split up using tools like rar into multiple smaller
files.  If a "bad guy" manages to post articles and corrupt some of the rar
files, he is only likely to have corrupted all of them.  When this happens,
and when the users can't figure out why the rar file is corrupted, they
simply get someone to repost the entire rar file.

However, with the xBin standard we are working on, all file transfers can
be fully automated.  The user should never have to look at articles again
to figure out what is broken, and should never have to step in to "fix"
transfers corrupted by the trouble makers.

But, if everything is automated, it has to be fool-proof.  We need to do
everything we can to make sure that no form of abuse can be used to prevent
a file from being trasferred.

Using a tree hash is a big first step in making this happen.  It allows us
to use the tree hash as the unique file-id for the file.  So when the user
decides to download a file, it's based on the tree hash.  He askes his
download tool to get a file with a tree hash of XYZ.  We still have the
problem of someone posting a file and describing it to be something other
than it is, but there other options to addressing that (as you know).

But, the intent is that "secure outside channels" are never going to be the
norm for usenet.  So it can not be assumed that most poeple will know the
truth about the file they want before they spot it on usenet and before
they choose to download it.

Now, with each article, will be the data from the file, as well as the
informatain about where that data is located in the full file (it's offset
and size), the total size of the file, it's tree-hash (which is the file-id
for the file), and the minimal number of tree hash nodes to prove that the
data is in fact from the file with the given root tree hash value.

Now, it's easy to prove all that data is self-consistent, expect for the
file size.  The size of the data obvious has to match the amount of data in
the article, and it's offset defines where it falls in the hash tree, so
the hash tree values supplied prove that the information provided is in
fact located where it says it is in the file.  And of course the fact that
the root hash can be re-calcuted and shown to match proves that the
root-hash is correct as well.

The file size, however, is impossible to prove correct (whitin limits).
Depending on how much tree data you provide, it's trival to take the data
from a reall 2GB file, and post a chunk of the file and lie about the size.
You can claim it's only slightly larger than 1GB for example if the chunk
of data is from the first half of the real file.

This is not a "killer" problem, but it's a problem.  Because someone could
post fake data about the file makeing the users and the dwonload tools
think the file was half the size it really was, or posting mutliple fake
articles all with slightly different sizes.  One of the featues of xBin is
that it would allow news servers to know how large the fill file was so
that servers could filter articles based on the full file size instead of
just the article size.  Servers that were not able to keep up with a full
feed could use this as a better way to filter "files" form the feed instead
of just filtering articles.

If the file size can be faked, we could no longer trust the file size and
could no longer do things like filter feeds by file size.

If a user decided to download a file, they want to know how large it is
before they start to download it so the download tool can accurately report
how long it will take, and how much of the file is currently avaiable on
the server.  If you don't have a valid file size, you can't report any of
this.  Or if you falsely "trust" the file size reported in the article you
see, the users, and the tools, can be tricked by anyone wanting to abuse
the system.

Also, the advantage of having a verified file size is that the file size
bits can be combined with the hash bits to create a larger effective hash
to further reduce the probability of collisions.  This is useful for xBin
because we are placing the file hash, along with the file size, the data
offset, and the data size, all into the Usenet Message-Id of the article.
But, because large Message-Ids cause issues on Usenet, we want to keep this
as small as possible, and we are talking about not including the full hash
in the Message-ID (though it would be available in the header and the full
hash would be used when verifying the data).  Because the full file size is
in the Message-Id as well, download tools could use the partial tree hash
combined with the file size to create an effective file-id hash which had
more bits.  It could use this effictive larger hash to uniquely keep track
of all the files it had in the users personal database of files he had
either 1) already downloaded in the past, or 2) was currently trying to
download now.

The fact that the file size needs to be in the Message-Id means that if
it's verified as valid, we can justify including less of the full tree hash
in the message-id.

> TigerTree (or other THEX tree-arranged hash) should be ideal for the
> issue of Usenet posts split into many parts. If it is necessary to
> know exactly where a part fits into the whole, and the size of the
> whole, with every part, then you should include (a portion of) the
> full tree with each part.
>
> That portion could be (1) all generations of the serialized tree from
> the node which includes the sent part on up to the root (in which case
> you could use the THEX serialized form); or (2) all the nodes in the
> same generation as the node which includes the sent part; or (3) an
> even more compact "proof", which only contains the barest minimum
> other node values to "paint in" the sent part's value, up to the root.
>
> So considering a file broken into 8 parts, A B C D E F G H, and
> assuming you're sending part C:
>
> The tree is:
>
> ......O.......
> ..M...+...N...
> I.+.J...K.+.L.
> A+B.C+D.E+F.G+H
>
> Under strategy (1), you'd send all interim values A B C D E F G H I J
> K L M N O (the full THEX tree) along with the data for part C. The
> recipient would know for certain the whole file's size, the whole
> file's treehash, C's size, where C fits in, and every interim hash at
> C's level and higher.

No, even with the entire top of the tree, you don't know how much data is
in part H.  The full file size can be reported as being +- the size of part
H and there is no way to veryify it.  i.e., you know the true number of
blocks, but not the number of bytes in the file.  We need to know file
length down to the byte.

We however can't really justify sending that much hash data in Usenet.
It's way too much data to be included in each article for the larger files.
If you have a 500 MB file broken into 500KB articles (typical of what is
done today on Usenet), you have 1024 articles in the post.  That generates
a tree depth of 10 and about 2047 hash values to include in each articles.
If Tiger is the underlying hash function, you are talking about 50KB of
hash data before encoding.  We really can't (well - don't need to) justify
sending that much extra data with each 500KB article.

> Under strategy (2), you'd send just the bottom interim values A B C D
> E F G H along with the data for part C -- because I J K L M N O are
> all trivially calculatable from the bottom generation. Again, the
> recipient would know for certain the whole file's size, the whole
> file's treehash, C's size, where C fits in, and every interim hash at
> C's level and higher.

That cuts the size of the hash data in half but still doesn't solve the
problem of knowing the correct size of block H.

> Under strategy (3), you'd only send the barest minimum of other values
> to prove where C fits in -- D I N -- along with the data for C.

This is exactly what the xBIn plan is.  The data is sent in the more useful
order I D N however.  This allows the hash data to fit into the headers of
a Usenet articles which is very advantageous because the NNTP protocol
allows you to download the header of an article without downloading the
entire article.  NNTP also does not provide any clean way of downloading
only part of an article, so if the hash data was located at the begining of
the article body, there's no clean way of downloading that and not the
entire article.

Also, putting the hash data into the header makes it far cleaner to be
backward compatiable with current article formats.  All current tools will
ignore extra data in the headers but it will be much harder to put data
into the body without causing problems with current (non xBin aware)
download tools.

> (D
> with C is enough to calculate J, J with I is enough to calculate M, M
> with N is enough to calculate O.) Here, the recipient would know for
> certain the whole file's size, the whole file's treehash, C's size,
> where C fits in, and the interim hashes between C and the root value.

But with the minimal hash data, it's trival to lie about the true size of
the file.  I can post the same article as in your example, which includes
the real data for chunk C, and includes the hash values I D N, but instead
of claming the file is 8 blocks long, I can claim it's only 5 blocks long -
that block E is in fact the last block of the file instead of H.  If it's a
2GB file, I can in fact claim it's only 1GB+1 byte long.

> -- Even the "send the whole (top of) the tree" strategy #1 is a small
> amount of overhead compared to large files: Splitting a 1GB file into
> 1024 1MB segments only requires a full tree of 2048 interim values,
> ~48K. That's under 5% overhead per 1MB part. (For strategy #2, that'd
> be 1024 interim values: 24K, <2.5% overhead. For strategy #3, that'd
> be just 10 interim values, 240bytes, <0.03% overhead -- but much more
> complicated code as random parts come in.)

It's imporant that the "overhead" be included with each article and not
transmitted separately.  This allows each article to be verified as a
stand-alone entity which is exactly how Usenet works.  usenet servers
transport "articles", not files, so decisions about filtering or blocking
articles will work best if they can be done on an article by article basis.
The hash tree using the minimal hash format allows this with very minimal
overhead and a large amount of backward compatibility with current article
formats and download tools.

But the minimal format allows you to lie about the length by  +- the size
of the data covered by the last hash block in the set which can be up to
50% of the true file size.

Any P2P like file-sharing network which allows partial files to be posted
and transported by the network will share this same problem.  If I submit a
partital file, with hash tree data, to any network, you have to trust that
the file size I'm telling you is correct because without access to more
data, the network has no way of verifying I'm telling the truth about the
size of the file.  And, if you use bitprint, or any form of full-file flat
hash (I use that term to describe any non-tree hash), like SHA-1, you
likewise have to trust what I tell you about that hash because since I am
only transporting a partial file segment, the network can not verify what I
claim the SHA-1 hash of the full file is, or that the length I claim for
the full file is correct.

This is the "file size problem" I speak of.  It happens in any network
which can not trust the people submitting the data and which allows partial
files to be transported.

So, lets look at possible solutions...

From your example above, one thing we can do is include the hash of the
last block in the file, and only the minimal set of hash values above that
requied to prove that the hash value is valud. So, instead of just
including I D N, we could replace N with H and other values needed to prove
our "H" which would include I D K G H.  That doesn't solve the file size
problem, but it reduces the amount of possible "lie" to +- the size of H.

To prove the size of H (down to the byte), the only solution is to include
the data from the last hash block (block H) in every article instead of
just the hash of H, so that makes the proof data in the above example (I D
K G Block-H).  For a block size of 1024 bytes, that could be done (within
the amount of data we can justify adding to every usenet article), but it's
messy.  And it couldn't easilly be done only in the headers which is a
problem for Usenet.

Another solution is to fold the file size into the hash. There are various
options for doing that.  To maintain some degree of compatibility with the
TigerTree hash used by Bitzi, we could fold the full size of the file into
the hash only at the top level.

So, the xBin hash would be calculated as H(TTH+FullFileSize).  That is, we
would concatenate the Bitzi root TigerTree hash, with the full file size
(in some well defined format), and hash all that to come up with the xBin
hash which was used within the xBin standard to uniquely identify files
posted to usenet.  It would now be impossible to lie about the true size of
the file associated with ID XYZ. You could now prove that all the data
within a single article (with no help of any outside source), was
self-consistent and came from the file with hash XYZ and size ABC.  And, we
would still have the Bitzi compatible TTH for the data for anyone wanting
to take advantage of that.

Yet another, cleaner, but non-compatible, way to deal with the file size
problem is to use a hash tree algorithm which folded the size of the
underlying data into the hash at every level.  This would allow you to use
the same hash function at both the leaf and and internal node levels of the
tree.  IT would be H(data+size) for all levels.  If the file was less than
one hash block in size, the hash would simply be H(data+size). (+ is
contatenation).  For a file of 1124 bytes in length with a 1024 byte hash
size, the hash function would be:

  H(H(B1+1024)+H(B2+100)+1124)

Where B1 is the data from Block 1 (the first 1024 bytes of the file), and
B2 was the rest of the data in the file.

This is what I would choose as the hash function if we decided that
compatibilty with the bitzi work was not important.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#64996
Author: Curt Welch
Date: Thu, 24 Apr 2003 03:04
44 lines
3645 bytes
"Mirco Romanato" <painlord2k@yahoo.it> wrote:
> Just now, I think, could be used the TigerTree like it is now.
>
> Shareaza have this problem, with different TTH code in different versions
> of the client 1.8.00 - 1.8.0.20.
>
> It used a version number for the TTH in the N2R conversion when there is
> a request for the file.
>
> This could be done in Xbin standard, so it will let different version to
> cooperate, in case bugs are finded and corrected.

The idea of using a version number or other form of hash identification to
allow switching to a different system later has been talked about, and the
system will allow that.  But, changing to a different system at a later
date will be such a set back that it's most likely the switch would not
happen.  The need to change would have to be great before it would happen.
The reason is because files will be identified by their hash. People will
build up large databases of every file they had downloaded to prevent
downloading the same file at a later date.  The will have databases (like
bitzi) that document what the files are.  People will build databases of
ids to identify spam posts so they can be blocked.  People will over time
can build up a large set of files their newsreader is trying to to complete
(and which may have remained partially downloaded for years on their
server).  If you switch to a different hash system, all this built up
knowledge must be thrown out the window.  The hash system we pick for xBin
will have to be "very" broken before we can justify changing it.  And
because "security" is not a big issue with this applicaiton, even if the
the hash is proven to be "weak", that's not likely to be enough to justify
a change.

So, even though we will make sure the option of switching to a different
hash is always available, and also, the option of supporting a dual-hash
system to allow for supporting two hash values durring a transistion, the
odds of needing a change I suspect is fairly small.

The most likely option that could force a change I think is the one you
have brought up here - the desire to be compatible with some system outside
of Usenet.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#65018
Author: Mirco Romanato
Date: Fri, 25 Apr 2003 19:07
64 lines
4112 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030423230423.230$fE@newsreader.com...

> The idea of using a version number or other form of hash identification to
> allow switching to a different system later has been talked about, and the
> system will allow that.  But, changing to a different system at a later
> date will be such a set back that it's most likely the switch would not
> happen.

Crypto is an evolving science, so is good to have backup plan to safefail.
If the protocol is designed to implement more different type of hashes and
hashes tree its life will be longer.
The change will be managed graciously from the new softwares, so users don't
need even to know this if it happen.


> The need to change would have to be great before it would happen.
Agree


> The reason is because files will be identified by their hash. People will
> build up large databases of every file they had downloaded to prevent
> downloading the same file at a later date.  The will have databases (like
> bitzi) that document what the files are.  People will build databases of
> ids to identify spam posts so they can be blocked.  People will over time
> can build up a large set of files their newsreader is trying to to
complete
> (and which may have remained partially downloaded for years on their
> server).  If you switch to a different hash system, all this built up
> knowledge must be thrown out the window.  The hash system we pick for xBin
> will have to be "very" broken before we can justify changing it.  And
> because "security" is not a big issue with this applicaiton, even if the
> the hash is proven to be "weak", that's not likely to be enough to justify
> a change.

All these reasons to maintain the same hash version is the same reason Bitzi
implemented two different hashes.
If this is a real concern, you could add in the header a hash backup (using
SHA-1 or maybe SHA-256 or others).
If one of the two alghoritms is defeated, you will have the other to ensure
the identity of the file, and will have time to develop, implement and
deploy a new alghoritm to replace the first.


> So, even though we will make sure the option of switching to a different
> hash is always available, and also, the option of supporting a dual-hash
> system to allow for supporting two hash values durring a transistion, the
> odds of needing a change I suspect is fairly small.
It will always be a small chance, but time is long and Muphy Law rule
forever.



> The most likely option that could force a change I think is the one you
> have brought up here - the desire to be compatible with some system
outside
> of Usenet.

:-)

Mirco


Re: xBin library version 0.1
#65019
Author: Mirco Romanato
Date: Fri, 25 Apr 2003 19:15
20 lines
1886 bytes
"Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
news:20030423174743.167$Fo@newsreader.com...
> "Mirco Romanato" <painlord2k@yahoo.it> wrote:
> > "Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
> > news:20030421201204.318$Ng@newsreader.com...


> Let me explain the "file size" problem...

Interesting!

The solution compatible with Bitzi like me much.
The ID could be done from the Xbin hash + the TTH + filesize =< 100 bytes ?

I need to find data about Message-IDs.

Mirco


Re: xBin library version 0.1
#65030
Author: J.B. Moreno
Date: Sat, 26 Apr 2003 18:51
22 lines
1988 bytes
In article <ePfqa.67382$DT4.1997396@twister1.libero.it>, 
 Mirco Romanato <painlord2k@yahoo.it> wrote:

> "Curt Welch" <curt@kcwc.com> ha scritto nel messaggio
> > Let me explain the "file size" problem...
> 
> Interesting!
> 
> The solution compatible with Bitzi like me much.
> The ID could be done from the Xbin hash + the TTH + filesize =< 100 bytes ?
> 
> I need to find data about Message-IDs.

Message-ID's are *the* most commonly used element of an article, and
are frequently quoted (see above) and so should be as short as
possible.

But technically they could be over 200 bytes (less than 250).

-- 
J.B. Moreno
Re: xBin library version 0.1
#65031
Author: Curt Welch
Date: Sat, 26 Apr 2003 19:08
94 lines
6373 bytes
Ok, so I'm a little slow replying to this message....

pmrobinson@gmx.net (Peter Robinson) wrote:
> Curt Welch <curt@kcwc.com> wrote:
>
> > the current posting conventions creates segements which are a
> > multiple of 45 bytes (the number of bytes encoded in each uuencoded
> > line). To be compatible with this limitation, we (I mostly) argued that
> > it would be best to pick a block size for xBin which was a multiple of
> > 45.  The current front-runner for this is 22500 byte blocks. (500
> > uuencoded lines).
>
> Where did the 500 come from?

Somewhat random really.  But it puts the hash block into a size range which
seems "good" for Usenet and allows people who post in uuencode format to
maintain an old standard of posting in multiples of 1000 lines.

> > I've also had second thoughts about using a non power-of-two block size
> > for other future reasons and thought that maybe a 32K block size would
> > be better.
>
> I haven't been following all the discussion, but could you compromise
> with something like 512*45 bytes (22.5KB)?

Yeah, that's always an option.  Anything is an option.

> Perhaps having a block size
> that's 'not quite' a power of two is no better, though.

Yeah, I think that was the thought processes.  Once you decide to go with
something that isn't a power of two, then there's not a lot of point with
going with something like 512*45.  If for example you were trying to fit
the data into larger blocks like 4K or 16K, then these 512*45 blocks would
not be much of an improvement over 500*45.

The issue is that the performace of the code that scans a file and
calculates the hash is really not changed enough to measure with
power-of-two aligned blocks or otherwise.  The larger the block, the
smaller the size of the hash tree, and the less work envolved with
calculating the hash values in the hash tree, but the block alignment
issues are normally mostly invisible.  Typical code these days is already
using buffered disk IO which is forced to copy the data blocks already, so
if you read into a buffer of size 20500 (45*500 500 uulines) or 23040
(22.5K - 512 uulines) you can't even measure the performance difference.
And, in most cases, all the code is disk I/O bound so minor changes in the
amount of CPU work is meaningless.

The reason for trying to stay with a power of two is at first just one of
esthetics.  Down the road, you just expect that things will change and we
will drop uuencoding completely yet for 50 years after that, we are still
using this hash block size of 22500 bytes and nobody remembers why.  So
estheticly, it just feels wrong to go with a 22500 block size even if you
can't justify it for a performace reason.

But, what I later realized is that xBin is likely to transform our view of
what Usenet is doing in terms of binary file transport.  Instead of the
article transport system it is today, we will start to look at the binary
side of usenet as a binary distribution system which moves and stores
hash-block sized chunks of data.  Whatever we end up using as the hash
block size will become the basic chunk of data which the servers can
transport and store.  This could easily move us to a more P2P like
file-chunk sharing system where we will might end up totaly restructuring
how the news servers store the binary data.  If they start to act as file
systems which store hash-block sized chunks of data, there are advantages
to be gained (less space lost or better efficiency) if the hash blocks
align with the disk block size or filesystem block sizes.

This makes me want to go with a power of two sized hash block.  But, will
the potential uuencode problems mean that people wanting to use uuencode
for posting will end up refusing to embrace xBin?  If so, xBin might end up
dieing before it every gets off the ground, so worring about the potential
future would be a waste of time.

uuencode should in theory work with any size data in each article because
you should be able to just make the last line of uudata in each file
shorter.  It would be good to test many of the multipart uudecode
tools/newsreaders on usenet to see how many of them do work with short
lines and see if any do seem to have problems with them.  Maybe in
practice, none that we can find have a probem with short uuencoded lines in
which case, the risk of using a hash block which was not a multiple of 45
bytes is less of an issue.

And now we have the issue of looking at other tree hash standards like
Tiger Tree as used by some of the P2P systems.  It uses a 1024 block hash
which is nicely power-of-two based, but it's smaller than we might
otherwise want so it creates larger hash trees.  But maybe they are not
"too large" and helping to create a net-wide standard for file-ids for all
types file-sharing systems would be a good thing for all.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Re: xBin library version 0.1
#65096
Author: Curt Welch
Date: Wed, 30 Apr 2003 22:48
261 lines
15560 bytes
Sorry for the delay on this follow up....

"Chris AtLee" <catlee@canada.com> wrote:
> On Thu, 10 Apr 2003 21:46:00 +0000, Curt Welch wrote:
> > "Chris AtLee" <catlee@canada.com> wrote:
> >> On Wed, 09 Apr 2003 23:14:13 +0000, Curt Welch wrote:
> >> > "Chris AtLee" <catlee@canada.com> wrote:
> >> "In order to protect against collisions between leaf hashes and
> >> internal hashes, different hash constructs are used to hash the leaf
> >> nodes and the internal nodes.
> >
> > Very odd.  I have no idea why they think 1) doing that will protect
> > against collisions, and 2) why that is useful.
> >
> > I had scanned that web page before but didn't read it careful enough to
> > notice that.
> >
> > Does anyone see _any_ point in doing that?

Just wanted to point out that I now understant this.  The current tiger
tree hash used by bitzi and others now does this.  They add an extra byte
in front of the data for each hash block and for each node in the hash
tree.  The value of the byte is 0 for data blocks (leaf nodes) and 1 for
hash nodes (internal hash).  If you don't do something like that, then it's
trivial to create a short file which duplcates the values from the top hash
node and end up with two different files having the same tree hash value (a
collision).

> > The section is under the description of Merkle Hash Trees so maybe this
> > was an idea that Merkle added in his original paper?
> >
> >> I haven't checked the source to see if tigertree hashes actually use
> >> this or not, but this is where I got it from.
> >
> > I've looked at some TigerTree code and didn't notice it doing anything
> > like that.  But, I might have missed it just like I did when I read the
> > above document because I didn't expect it to be there.
>
> I just checked, and they don't do anything like this.

It's been changed.  It does do it now.

> >> All
> >> of this means that the xBin headers will be slightly larger since the
> >> TigerTree hash is longer and minimal hash tree complement will be
> >> larger since the merkle hash tree is larger.
> >
> > Yeah, there are issues.
>
> <snip>
>
> > For usenet, we really need to put these hash values in the header, not
> > in the body.  We need to add this hash data to the posts in a way that
> > won't break current decoders.  With yEnc, because there's a begin and
> > end marker in every article, it would be straight forward to define a
> > text format for the hash data which was placed in the body, but outside
> > the yEnc data in the article.  Current yEnc decoders would just ignore
> > it.  With uuencode however, there are no begin and end markers on each
> > article, so adding any extra text in the body is likely to break some
> > decoders.  You might be able to make it work because most decoders
> > already have logic to ignore signatures added by some servers to all
> > posts, so maybe hiding the hash data in a signature at the end of the
> > body would work.
>
> <snip>
>
> > But, putting the hash data in the headers would work for sure in terms
> > of not breaking current usenet decoders.  And, on top of that, having
> > it in the header allows clients to fetch the hash tree data with HEAD
> > commands without having forceing them to fetch the entire body.  There
> > are various applications were this would be useful.
>
> Hmm, I hadn't thought that the hash data would be useful without the
> article data...The root hash (or part of it) needs to be in the headers
> so that clients can quickly find articles with HEAD commands, but why
> would having the "minimal hash tree complement" in the headers be
> necessary? You can't tell if it's valid or not unless you download the
> entire article.

That's true for a single article, but you can tell if it's valid if you
have the data from multiple articles.  All you need is data from two
articles which contain no overlaping file data and that will give you
enough hash tree information to verify all the hash tree information you
have from both articles.  At least I'm fairly sure that's true.  I'm sure
you verify most the data but if the articles are of different enough sizes
you might end up with a few hash tree values you can't verify.

You can for sure verify hash tree data without the article data as long as
you have enough of the hash tree.

One area we have discussed where collectiong and saving the hash-tree
values might to be important or useful is when dealing with par files.  We
have talked about how par files might be done under xbin and the most
complex issue is how to veryify the par data.  Basically you can't verify
it without using the par data to recover article data, and then verifying
the article data.  This is not ideal becaues it means that news severs
won't have the ability to verify par articles individually.  Ignorhing that
however, if xBin does support par articles, then we come across the issues
of what hash data to include with each article of par data.  The par
article may allow a large span of hash blocks to be reconstructed, so one
option is to include enough hash data to allow any single hash block to be
verifyed - that amounts to including almost the entire hash tree worth of
values with each par article.  That could be done, but it's a lot of data.
The advantage is that _any_ hash block that gets reconstructed using that
par data can be verifyed.

Another more resonable option in terms of how much hash data you send, is
to treat the par data is if it were one huge segment of the file and
include the same hash values you would as if you had included that entire
file segment in the article.  For example, you could generate par articles
(500KB in size) to protect a single 100 MB section of a 500 MB file.  Each
of these par articles would allow you to replace any missing 500KB articles
in that 100MB range of the entire file.  The xBin hash data you send with
the PAR articles would be the same as if you had posted the entire 100MB
range of the file in one article.

With that hash data, you can not verify single hash blocks in the range or
even single missing articles in the same range.  But, you can verify the
entire 100 MB range once it had been completely reconstructed.

This means that once you have enough file data, and par data, to complete
the entire file, the tool can reconstruct all the missing blocks, and then
veryify if everything is correct.  But if it finds something isn't correct,
it is impossible to know which par article is corrupted (or intentially
posted for the purpose of causing trouble).  All the download tool can do
is try to find more article or par data, and if you have more par data,
start playing mix and match games with the par articles you have to see if
any combination produces a complete file.

But, if you have 11 par articles, and are missing 10 files, the download
tool has to try 11 different combinations of par data to see if any
produces valid data.  And if you have to reconstruct all 11 missing
articles before you can verify the data, it can take some time to do this.

If, however, the download tool maintains a partially verifyed hash tree for
the file, it can try to use that durring the reconstruction process to
prove the data invalid sooner, and potentially greatly speed up this mix
and match game it must play.  It can reject a combination of par articles
after re-computing only 1 hash block at times instead of having to
recompute 10 full articles worth of data.

So, the idea of these download tools collecting and storing partial hash
trees has some potential use.  It can collect and build the full hash tree
and remember which values have been verifyied, which are unknown, and which
are known, but unverified.

Putting the hash tree data into the headers allows tools to just use the
HEAD command to collect this data from every article it finds associated
with a file it is interested in.

An example of when this would actaully be used with par data is when you
had already download most of a file, and also have 10 par files, but you
are still missing 11 articles so the 10 par articles can not be used yet.
Then, the next day, when you check headers, the download tool finds that
someone has reposted 5 of the articles you are missing.  The download tool
can download 1 of those articles to have everything it needs to complete
the file, but it can do a HEAD on all of them to collect more hash tree
data to help speed the verification of the par data.

Another possible use of the hash tree data in the headers is as a pre-check
for a valid article.  If the Message-Id has the correct xBin data in it,
before the tool wastes it time download the entire article (which could be
a total fake), it can at least download the headers and verify the xBin
hash data (assuming it has partial hash data from other files alread).  If
the headers aren't there, or are bogus, then it would be wise for the
download tool to put that article on the "questionable" list and not waste
time downloading it unless the user wanted to (it might be valid data with
a valid xBin information in the message id but just not have a valid hash
header).  It is of course questionbale as to whether this step is worth
doing because it's easy to fake the headers and still put bogus data in the
article, but it's an example of one more thing that is possible if the hash
data is in the headers.

> If it does have to go in the headers, you could always split it up into
> Content-Merkle-Tree1, Content-Merkle-Tree2, etc.

Yeah, something like that is always possible.  I'm not aware of any servers
that put a size limit on the entire head, most the limits seem to be on the
size of each individual header.

How big can a header be?

It's not well defined.  We need to do more testing to get a better feel for
what the limits are in practice on todays Usenet.  Some servers have had
limits in the range of 1000 bytes but it's unclear to me if this applys
only to header that the server is trying to parse and analize, (in which
case it will not effect a specail xBin header that all the current servers
ignore), or if it applys to all headers.

>  Are headers 8-bit clean?  Otherwise multiply your above figures by 1.33
> for base64 encoding.

No, we can't assume they are.  You do have to encode them using something
like base64.

When we looked at this in the past, the answer seemed to be that for a hash
block size in the 22500 range, we could post fairly large files (in the 1GB
range if I remember correctly) without going over the 1000 byte limit.

Some servers today (like mine) have no limits on the header size or on the
size of lines in the headers.  I accidently posted an article with a header
that was about 200K the other day and it worked fine for example.  I
suspect that most transit servers for example have no problems with huge
headers (but I could be wrong).  But most likely, a very large portion of
usent would allow the transport and reading of articles with headers of
many KB using the HEAD command.  What is more likely to not work is XHDR
commends, or long headers in XOVER data.  And maybe, some servers will
reject the articles on post if the header lines are too long.  This is all
stuff we need to better understand before we lock some xBin convention into
stone.

And, if we switch to a tiger tree hash with a hash block size of only 1KB,
then the hash tree data can get a lot larger.  But, I later realized, that
this is not an issue if the posting software chooses article sizes which
align on larger power-0f-two hash block count boundries.  So if the posting
software breaks up the file into articles of 512 blocks each instead of 500
blocks, the hash tree data in the header will be much smaller.  So the
posting software has the power to keep the headers short, even for very
large files.

> > The hash block size also sets the minimum size of a multipart post.
> > People sometimes flood groups with 1000 part multipart posts which only
> > have 2 lines of uuencoded data per article.  Having a large minimum
> > size (32K vs 1K) is also seen as an advantage to make some types of
> > abuse like this easy and natural to filter at the source.  This however
> > I don't see as important at the other issues.
>
> You could restrict xBin posts to some multiple of 1K, but still use 1K as
> the hash block size.  In addition, restricting xBin posts to some power
> of 2 multiple of 1K, like 32K, would make the "minimal hash tree
> complement" much smaller since you'd be guaranteeing that the bottom 5
> rows (in this example) of the partial tree computed from the article data
> would be complete, therefore you wouldn't need to include anything below
> row 5 in the minimal tree complement.  (How's that for a run on
> sentence?)

Right, I see you are already said what I just wasted saying again above. :)

But I don't think we need to force that in the standard.  We can just point
out that if any xBin posting software creates headers longer then X (and we
can try to figure out what X is), that the article may not post or
propigate very well on Usenet.  And that to keep the header shorter, it
needs to be wise about where it decides to split the data for each article.

> So you could define an "xBin block" to be 32678 bytes, the
> size and offset values in the Message-ID header would use this block size
> to count, which would in effect restrict the posts to use that block
> size.  Still, the last post of the file may have too many hashes to
> include in the header since it wouldn't necessarily be a multiple of
> 32K...

No, that's never the case.  Even though the last article is smaller, it
will not include more hash values.  It would only need to include more hash
tree data to for the side of the tree that comes after the article, but
because the last article never has more data following it, that is never
the case.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads