🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #62401

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

#62401
From: Curt Welch
Date: Mon, 23 Dec 2002 09:11
377 lines
21669 bytes
Chris Morse <chris@invalid.com> wrote:
> On Sun, 22 Dec 2002 04:25:48 GMT, Chris Morse <chris@invalid.com>
> wrote:
>
> >
> >Hello,
> >
> <.. running with scissors ..>
>
> Someone mentioned "xBin", but I can't find much about it.
>
> "xBin.org - nothing here yet".

Yeah, that's my site.  That is what you were looking for, but as you see,
there's nothing there yet.

As was answered later in this thread, it was something that was growing out
of discussions here a few months back - and that was an outgrowth of stuff
talked about I think over a year before then.

> Can someone enlighten me on this?

You can dig up the threads on google and speed a few hours reading, but
I'll give an outline here. (which now that I've finished writing it, I see
will take you a few hours to get through anyway :)).

The idea grew out general issues with how multipart binaries don't work as
well as they should on Usenet and how many issues over time could be
improved if we move to a system where the news servers knew they were
transporting files instead of just articles.

One example of these problems is the issue that it's very hard to run a
news server that carries a partial binary feed.  A typical way to reduce
the size of a feed to fit in the bandwidth a server can deal with is to
filter articles by size.  You simply remove all articles over a given size.
It's generally wise because if you can't carry everthying, it's better to
drop a few huge posts instead of lots of small posts.

But for multipart posts, the size of the articles, and the size of the
actualy file being posted is not related.  If people are posing 10GB DVDs,
it would be better to filter than entire single post from the feed, instead
of dropping 100's of MP3 posts.  But when you drop articles by article
size, that 10GB DVD may not be dropped if the article size used is small
enough.

So, if the news servers knew thost articles were part of a 10GB file, then
dropping only that one 10GB file would be better than droping 100's of 10MB
MP3 posts or thousands of 200KB jpgs.

Other examples is the problem of headers.  No one wants to have to download
1000 headers just to get 10 files.  If 10 files are posted to usenet, it
would be nice if the news servers knew all the articles were part of the
same file and allowed you to download a special XOVER list which in a
compact form told the newsreader that there were 10 files and even nicer
nicer if there was a NNTP FILE command (like ARTICLE) which would allow you
to download the complete file (or segments of the file) already decoded and
re-assembled for you.

One day we might get there. But first, the news servers needs a "real" way
of knowing which articles contain file segments, and which are normal text
files.

So looking at this, and looking at problems of dealing with multipart posts
in general, some ideas of what might make sense to start with now were
generated.

The idea started with the simple concept of making sure that binary posts
(partically multipart posts) were labeled in a consistent fashion,
somewhere in the headers, so both news servers, and newsreaders/download
tools, could know for sure what they were dealing with instead of having to
play the current guessing games which is now done with the subject and
author of articles.

This evolved into the idea of encoding binary file information into the
Message-ID for multipart posts.  This would include basic information such
as a hash which uniquely identified the actual file, the total size of the
file, and the offset, and size of the segment of the file which was stored
in the current article.

Putting this information, which in all rights is stuff that belongs in
"normal" article headers, is at first glance very questionable.  You really
really don't want to move header data into the Message-ID.  And I've argued
strongly against adding information into the Message-ID for years every
time some finds something they should stick in there.  But, for this
application, I think we might have found a justifiable reason for doing it.

The reason is that news servers really could, over time, take good
advantage of this information if it's in the Message-ID.  For an incomming
news feed, the message-ID is the only thing sent to the server for it to
decide if it wants the article or not.  Someone running a text only-server,
or trying to run a limited binary server, has no easy way to regulate the
size of their feed now to fit their bandwidth limits.  But with this binary
file information in the message-id, messages chould be rejected, and the
file-size limits for rejection, could be chagned easily on the receiving
server without having to contact peers.  There's just no way to do that now
- which is why many servers that can't deal with a full feed just let their
peers drop articles at random instead by choice.  So you end up with 50% of
all multipart posts with missing segments instead of having a way to drop
just 10% of complete multipart sets and get the rest perfect.

Putting the correct file information in the Message-ID also allows downlaod
tools - especially ones searching multiple servers - to only download the
message-ids from the servers (XHDR Message-ID) and still be able to
correctly identify all the parts of a multipart file post.  This would
greatly reduce the amount of headers one has to download if all you are
trying to do is locate multipart file segments across a good sized set set
servers.

But, Message-IDs are easy to forge, just like Subjects are easy to forge
now which makes the automatic download tools easy to fool by simply posting
a set of "bogus" articles.  And with todays tools, even if you download all
the parts - the bogus ones and the real ones, trying to identify which ones
you need to correctly re-construct the file can be close to impossible if
the person generating the fakes knows what they are doing.

So we looked into ways to solve this, and came up with hash trees.

Hash trees are a special type of file hash which is built using any
standard hash function like MD5 or SHA-1.  They are bit complex.  But they
work by dividing a file into blocks, and calculate a hash for each block.
Then, for each two adjacent blocks, you take the two hash values, treat
them as one set of data, and calculate a hash of that data.  You continue
doing this calculating hashes of combined hashes in a big binary tree,
until you get to the top and have only one hash value left.  That becomes
the "hash" of your file.

We would define a specific hash tree algorthm, and make it the standard for
all multipart posts to Usenet.  We would need to pick, and standardize,
both the basic hash function used (SHA-1 MD5 etc), and we would need to
pick, and standardize a block size.  It's important that this be decided on
before it it gets into common usage because you don't want to try to change
it later.

This hash would then become a universe ID for the file being posted.  If
that file was every posted again, 5 years in the figure, you want it to
have the same hash value.  If someone is re-posting missing segments of the
file, you want it to have the same universal ID.

This hash is included (at least in part) in the Message-ID so the download
tool will have the power to identify reposts of segments, or reposts of the
entire file, simply by looking at the Message-ID.

The reason for using this special hash-tree system, is that it can be used
to identify fakes (or corrupted articles) without help from any external
information.

The problem with a noral file hash, is that there is no way of knowing if a
single post from a multipart post is a fake, or whether it actaully matces
the file hash in the Message-ID.  The only way to answer that is to
download all the segments, put them together, and calcuate the full file
hash to see if it matches.  If you have a 20 part file posted, and someone
posts 3 corrupted segments which are forged to look valid, how can an
automatic download too easilly figure out which of the 3 parts that are
duplicated are the fakes and which are the real ones?  It has to simply try
all possible combinations until it finds one that works.  The large the
post gets, the more unrealistic that becomes.

But, with the tree hash, you included with the post, in the headers, enough
hash values from the hash tree to allow the file hash to be re-calcuated
using the data in the article, and the hash values in the header.  So,
given a single article from a multipart posts, you can scan the data and
re-calculate the file hash.  And if it doesn't match the file hash in the
message-ID, you know that the post is corrupted (either by accident, or my
design) and should be thrown out.  And you know this without having to know
anything else about the file.  This means download tools can verify every
article as they are downloaded, and not have to wait to get the complete
set before the parts can be verified.  And, down the road, it means that we
can modify the news servers to reject "broken" posts at post time, or at
transit time, to filter out corrupted, or forged posts.

Mostly, what this starts as, is a way to correctly label binary posts.  It
requires that the correct message-id be used, and some other information be
added to the headers.  The rest of the encoding (yEnc vs uuencode, and
subject conventions) do not need to change.

But there are side-effects.  First off, you have to calcuate the file hash
before you can post the first part.  And that requires a full scan of the
file to be posted.  For most resoonably sized files, this is fairly fast,
but for really big files, this starts to take a noticable amount of time,
so some people users may not like this.  But, the advantages gained I think
will over time, force people to spend that time before posting.  The
posters will be doing the downloaders a big dis-service by not being
willing to wait for the time required to pre-scan the file.

But the larger side-effect is that because of the way the tree-hash works,
the file segments you post must be sized so they start and stop on the
tree-hash block boundries.  This means it's imposible to correctly label
"typical" posts after the fact because the amount of data placed into each
post is likely to be based on things like uuencod line lengths and not on
whatever would be picked as the Usenet standard for tree-hash block size.

But, if you are willing to force users to wait for a full file-scan before
the post can start, and adjust article sizes based on a tree-hash block
sizes, then, the only thing required to post articles in the correct format
is to add the message-id and put a tree-hash data into the headers.

To take advantage of articles marked like this however requies a bit more
work.  The first thing that could be done is to use it as a way to identify
corrupted posts - even if they are posted in uuencode format.

The bigger advantage comes when you write a download tool from the ground
up to look for, and download, articles in this format.  The advantage is
that all you need the identify the file you want to download is it's file
hash value - which serves as a universal ID for the file.  If you have only
one part of a multipart posts, and you decided you would like to download
the entire thing, all you have to do is give the download tool the
Message-ID of the that one part - not the group, or the name of the file,
or anything else.  Just the Message-ID.  The download tool can then search
multiple servers and find all the parts without ever downloading headers
other than Message-IDs.  And if parts are re-posted, or even if the entire
file is reposted by someone else using different part sizes, the download
tool can still identify the file as being the same, and figure out which
parts have to be downloaded to fill in the gaps you are still missing - all
automatically.  And if any parts are corrupted or forged, the only damage
done is that you are forced to download the article.  But once it's
downloaded, the download tool knows for sure if it's valid data or fake so
it can never be tricked into constructing a corrupted file.  When the file
is complete, the tool knows for a fact that file data matches the file-hash
you asked for.

On the issue of making it a standard, we seemed to have as many different
opinions on the "correct" way of doing things are there were people posting
to the thread when we last talked about it.  So to give us more facts to
work with instead of just theories, I went off and started to write a
proof-of-concept tools for this idea.  I grabed the xbin.org domain because
xbin seemed like a neat name for a binary posting standard (X as in
experimential) and there aren't alot of short domain names like that left.
But that was before I realized that "xbin" is an old tool for encoding mac
files in the binhex format so when you search for "xbin" on the net, you
get lots of references to that tool.  So xbin might not be the best name
for the standard.  Or maybe it will work.

What I have done is created a unix command-line tool which can post files
in both uuencode or yEnc and which generates an valid xBin Message-Id and
headers.  I'll be happy to share the code with anyone who is interested in
it.

To demonstarte the format it's using, I just posted a small 3 part mp3 file
to Usenet.  Here are the important headers added to the first of the three
parts:

X-Bin-Signature: x/I8REUBPHGJ+qcCiUb3TXz4Z80
  pRnksBkZcSiccM1/hkrWdEBd7u0 x+m6b4q/02G04s29ZNPQcRMToMg
  j/3IFK3di5igu5Z7KpjDoIkN33I 0MFRwrdF1rCYmcW5qCcs0+fM0B8
  yiZ65jmF1sZjCiHjUoKzBd75Wgw
Message-ID: <$XB$Hx/I8REUBPH$SEoJr$oAA$sBa$$3mK@xbin.org>

The X-Bin-Signature: is the tree-hash data needed to verify the data in the
article.  The hash is encoded in base64.  The first value is the full
tree-hash for the file. (the one that starts with x/I8...)

In the Message-ID is the xbin encoded information for the file.  It's found
between the $XB$ marker which starts the data, and the $$ which follows it.
The rest of the Message-Id can be any normal Message-ID format.  The
xbin.org host is not part of the standard.

There are single letter identifiers starting each value encoded in the xBin
data and each data field is terminated with a $.

The first is H - for the tree hash value of the file being posted.  But to
keep the message ID a resonable length, only the first 10 characters (60
bits) of the hash are included in the Message-ID. I used SHA-1 as the hash
function which produces a 160 bit hash.  The full 160 bit hash is the first
item in the X-Bin-Signature:.

The next value is the Message-ID is S - the full file size, encoded in
base64.

Then o - the block offset of the segment included in the article, and
then s - the number of hash blocks included in the current file.

Blocks are used instead of bytes for the offset and the segment because the
file must fall on these boundries anyway, and this allows the message-id to
be be smaller than if byte offset and segment sizes were used.

The last block in the file however will be shorter, and this fact is not
shown in the segment size since it shows only the number of blocks.  So to
figure out the true byte size of the current article, the file size must be
used to determine if this is the last block in the file, and if so, how
many bytes are in it.

So there you have it - an overview of what xBin is all about.

What's left to do is write a article verifiying tool - first to show it can
be done and second - to veryify that what my posting tool is produceing is
even valid.

Then we have to decide if this idea is worth trying to make a Usenet
standard.  And if so, what changes need to be made to what I've already
suggested.

Getting it included in a popular posting tool will bascailly get it on it's
way to being a defacto standard fairly quickly.  And because it shouldn't
break anything in terms of all the current download tools, there shouldn't
be a lot much resistance to it.

The only big issue is trying to iron out the details so we have a standard
that people will be able to live with before it "leaks out" into wide
spread use.

> All I know is that it's some sort of binary posting convention.
> I have my own ideas on UUE/yEnc posts, but would be interested to hear
> about other proposed approaches.

The Xbin standard would start simply as a way to label posts  so it's not
changing or attempting to fix anything about uuencode or yEnc - but it does
add a very strong file data hash on top of both of those and it does put
important information about the file being posted into the headers where
both news servers and news readers will have access to it without having to
download the file or scan and parse the body.

> As I am also implementing
> Power-Grab, I sort of get to control both sides of it (posting &
> downloading).  By proving useful data (in headers) for UU/yEnc encoded
> file parts, I can help at least with the detection of errors.  UUE
> data could greatly benifit from this.

Yes.  That's the point of xBin.

> I am considering the ability/option for Power-Post to actively search
> for refill requests (by use of XPAT) and allow for the automatic
> requeueing of just those parts requested.  (The request being in a
> format syntax, and easily producable with Power-Grab.)

Tieing that in to a standard like xBin gives it even more power.  The
repost requests would include, in an easy to parse form by power-post, the
xBin file hash, which uniquely identifies the correct file with no
confusion over file-names, and the block-ranges which need to be re-posted.

Par file technology could be supported by this as well, but it would have
to be built into the xBin standard to work correctly.  That gets complex.

The other dream of xBin is to "fix" posting so that people would no longer
need to break huge files into lots of small rar files (or master spliter or
whatever).  It would allow you to post a huage file as 1000 parts if that
is what it takes.

The idea is that since the download tool can identify parts on it's own,
accuratly, there's never any question over whether you are downloadting the
correct articles.  This means that all the parts of the post don't have to
be on the server to start the download.  The download tool simply maintains
a list of all the files it's trying to download, and as it scans
message-ids, it looks for file segments to help fill in the missing blocks
from the files in-progress. If something is reposted later, it just works
automatically without the guy doing the download having to identify and
mark posts as possible "fills" for his missing files.

If you add the feature to post an automated re-post request, then the user
can look at the stuff he's trying to downlaod, and if thinks no more parts
are comming, he can hit a button to request a repost of everything he is
still missing.

And likewise, repost requests can automatically be spoted, and if the
download has any segments in the download folder for what is being
requested, it can show a list of files that can be re-posted to help fill
the requests.  If the guy wnats to help out, he just clicks it to have it
added to the stuff to be reposted.

And, with xBin, the reposts don't need to be the same article size as the
original.  A single part from the original post might has been posted as a
600KB article.  But the repost of that single part could be sent out as 3
200K articles (increasing the chance that all the parts make it to the guy
this time).  This won't confuse the download tool because it tracks missing
data by tree-hash blocks or bytes, not by articles, and the Message-Id
tells it everything it needs to know about the article to make the data fit
correctly in what is still missing.

All this stuff is a bit complex.  It might prove to be too complex for
Usenet.  But I think it could make multipart posts work a lot better than
the current work and the conversion to the system I think can be fairly
painlessly because of the ability to maintain backward compatibility with
current conventions.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021223041127.986$6M_-_@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
References: <cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com>

Show Full Headers
Complete Article Headers
Message-ID: <20021223041127.986$6M_-_@newsreader.com>
Subject: Re: xBin (Power-Post 2003 - requesting input from authorities..)
Date: Mon, 23 Dec 2002 09:11:27 +0000
From: curt@kcwc.com (Curt Welch)
References: <cdda0v4h6t52ov7abf1j0qkpo843itf4se@4ax.com> <cfka0vsbjdlbdmtv2gg8qnehok033qh5f1@4ax.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!news.maxwell.syr.edu!feed3.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com QOjq+YGd0F3m@yi8-n+pNLxapKr3@pWz+fcfRAlxTXx/qYd
X-Face: "p}G*1KH{+F7EYGKLb>ogDguabZ+%,?^epeFB!nzu`)`$=QcvL1KF6<0GH!Tbc!Sqo[|tV5
  %IW48mQf3K=Ci&gZ7]]aazx@]Y-nq!r5{yH/#,?@lDdUDvOfByB2hVW0.@OM%{l/{cT'{w
X-Url: http://CurtWelch.Com/
User-Agent: NewsReader.Com
Lines: 376