🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #61305

[xBin] some examples (was [FNTP])

#61305
From: Curt Welch
Date: Fri, 11 Oct 2002 07:52
114 lines
6818 bytes
I've got the beginning of some protoype code working to generate the type
of hash system we have been talking about in the NFTP thread.  It scans a
file, generates the entire hash tree, and they decides how to split up the
file into multipart files, and for now, just spits out fake headers (well,
it's actually connectiong to an NNTP sever and logging, and selecting the
group as well, but I'm not to the point where I actually want to do the
POST commands yet).

Here's an example article header that it's generating (most the stuff is
debug information and not how it would actually look in a real article).
BTW, This test file is about 5MB and it takes about 1 second to scan the
file, and connect to the server and get read to post.

I'm using an SHA1 hash which is 160 bits here.  The hash and other values
are being converted to Base64.  The Offset and Size refeer to what segment
of the entire file is included in this article and are in units of hash
blocks, which on this example was 1024 bytes each.

The Hash-Signature are all the hash values needed to verify that this data
really is part of the file with the given File-Hash. The numbers in front
of each hash value are the range of blocks from the file which that hash
covers.

The number of hash values needed in the Signature is complex because it
depends on the alignment of the data in the article relative to the file.
If you stick with an article size where the number of hash blocks is a nice
power of two, then the number of hash values you need in the signature is
contant for all articles.  But if you don't stick with power of 2 sizes,
then you need to add more hash values.  My code currently figures all that
out and includes whatever is needed.  This one article is the worst case
example from this run because it needed 14 hash values.  Others only needed
6.

The Message-ID includes the full 160 bit hash, the full file size, the
offset (in blocks) for this segment, and the size of this segment.  It has
no random data addeded yet - but that would be required as well.  I used #
instead of ~ because # doesn't cause problems on a Unix command line.  ~
might look nicer.

The Message-ID, as is, is 59 characters long.  Large, but workable.

I've included a real airnews ID under it for reference... :)

Subject: fake-song.mp3 (09/11)
File-Size: 5304320 (base64: UPAA)
Block-Size: 1024
Offset: 3768 blocks (base64: 64)
Size: 471 blocks (base64: HX)
Article-Bytes: 471 KB
File-Hash: /ccfp4olQYjcAXkQdtqNUEMl/jM
Hash-Signature: 0-2047 e4I7TYyZX+AC46oAsNGbo3es8+s
                2048-3071 cgceUJgfpagS/UI+FFeZyKdNjzo
                3072-3583 ezrJkm78eNcswCuEfoG3r5cJ3AE
                3584-3711 Fjlsh7yi1mRknXD72cNwAuAMRJI
                3712-3743 q3qk2ajtJ7FH8lo4/UUifQaO5XE
                3744-3759 HENIqxEZCm4cwkPb4JOCwHtczNA
                3760-3767 su8T4yo5IWJDZb73e7rmcU06wxQ
                4239-4239 kWLP7Nfd7UIsmuJaM5G16EQCAkk
                4240-4255 M2U73zYqLFz4kHCUCtJTWFnY/u4
                4256-4287 aW4RW7+nxAuljcy1yYUtGkCaUcU
                4288-4351 ojmlY/89uOuxG8LmYcM9Bc1iAy4
                4352-4607 xyXZNCPzdh9OpxC1WiAzpd/H5mo
                4608-5119 SBJY44qQ8PhxaFHmSeMqZDhbf1k
                5120-5179 Uua7QECo7dOkc06p85SkzRDc/So
Message-ID: <#XB#H/ccfp4olQYjcAXkQdtqNUEMl/jM#SUPAA#o64#sHX##@xbin.org>

Message-ID: <FE88B2BE7FE02017.23410DB6222218E4.EE9D873B867EB5CD@lp.airnews.net>


Here's a example of the same file using a block size of 45K. Note that only
9 hash values are needed now in the worse case file from this example.  And
the Message-ID is two bytes shorter because the block numbers are smaller
(larger block means less blocks total in the file).  But the sizes of the
articles varried from 495KB for the large ones to 410KB for the last one.

Subject: fake-song.mp3 (03/11)
File-Size: 5304320 (base64: UPAA)
Block-Size: 46080
Offset: 22 blocks (base64: W)
Size: 11 blocks (base64: L)
Article-Bytes: 495 KB
File-Hash: Ze4E38t6JYcSypFH/I16cm6Kygk
Hash-Signature: 0-15 0qNCHhaQ/C34WM8bdy5Ja8h0DCM
                16-19 3JzzYKNxpak2C/QZEw5qkqiu6Xk
                20-21 djhQoqi4mLGAnEqcjkUA+c2sIWY
                33-33 lO5JrpTW9I7stZCs8b+2TcylWuU
                34-35 +sWkIoA2GDb8EwNp3c9F5tnoJt4
                36-39 8HEnogea7Z5N696d77BtMKzgQjs
                40-47 Xifpeio1c7xpJB89hD3TX+/mxMw
                48-63 C9tHD38dBLXsPXAbqM9naLMJqzA
                64-115 J02wl8irh/8AwlEosnKkeFCANyA
Message-ID: <#XB#HZe4E38t6JYcSypFH/I16cm6Kygk#SUPAA#oW#sL##@xbin.org>

Why 45K you ask?  Because uuencoded data as 45 file bytes per line.  So if
we want to be able to support uuencoded data without requring a strange
short line at the end of each file, we need to use a block size which makes
it easy to get an even number of uuencoced lines in each file.  If you want
to keep the block sizes aligned on disk blocks, and allow uuencode lines to
fall nicely into each block, you need to go with either 45K to align with
1K blocks or half that to align with 512 byte blocks.  I kinda liked the
45K number.

YOu could pick a smaller block size and force anyone trying to do
uuencoding to pick a number of blocks for each file which makes sure the
line size and block size align, but if you just pick 45K blocks as the
standard, anyone producing uuencode output doesn't have to think about it.
Each 45K block will be aligned for them and they can put any number of 45K
blocks per file and know it will always be aligned on uuencode line
boundries correctly.

-- 
Curt Welch                                            http://CurtWelch.Com/
curt@kcwc.com                          Webmaster for http://NewsReader.Com/
Technical Details
Message-ID: <20021011035242.323$xD@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!canoe.uoregon.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!66.250.146.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <20021011035242.323$xD@newsreader.com>
Subject: [xBin] some examples (was [FNTP])
Date: Fri, 11 Oct 2002 07:52:42 +0000
From: curt@kcwc.com (Curt Welch)
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!canoe.uoregon.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!66.250.146.10.MISMATCH!newshosting.com!news-xfer1.atl.newshosting.com!38.144.126.75.MISMATCH!feed1.newsreader.com!newsreader.com!news2.newsreader.com!ellis.newsreader.com!not-for-mail
Organization: NewsReader.Com
Newsgroups: news.software.nntp
X-Trace: NewsReader.Com 0,5-w033/y5ueLoEJdeflMyhVHpEp4G81zfw8_8-nkOjqk
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: 113