🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #63423

Re: Content-SHA1-Tree

#63423
From: Kjetil Torgrim Homme
Date: Mon, 20 Jan 2003 15:44
181 lines
9322 bytes
[Curt Welch]:
>
>   Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no> wrote:
>   > perhaps, but SHA1-Tree is more descriptive (and not strictly
>   > wrong) than Xbin-Signature.  SHA1-Tree sounds more sexy,
>   > Xbin-Signature sounds like something cooked up in a bedroom.
>   > perhaps "SHA1-Signature"?  or "Tree-Signature"?  not a big issue
>   > for me, though.
>   
>   The important fact is that it's data which includes not only the
>   idea of a tree hash build on SHA1, but it also includes a defined
>   block size (unless you want to include the block size in the
>   header data somewhere), and, it's not just a hash value for the
>   full file, but it's the hash of the missing data, which makes it
>   even more unlike anything else.

you can't put the entire RFC in the name of the header, you know :-)

>   Nothing comes to mind as a "correct" name for this data.
>   "signature" is the closesest I've been able to come up with but
>   even that doesn't really fit with the more tyical use of the word
>   for these things.  Well, maybe something like "checksum" or "CRC"
>   really fits the concept beter because it's information used to
>   verify the integrety of the data.

Content-Integrator (isn't someone who checks integrity an integrator?)

seriously, Content-Fragment-Check might work (but implies it can't be
used with a complete file).

>   > why?  I think it fits naturally as the first hash in the
>   > signature data.  another header makes the parser more complex.
>   
>   Ok, I take that back.  To veryify the data you need the full hash.
>   The rest of the header is useless if you don't have the full-hash
>   somewhere to compare the result to so it does actaully fit nicely
>   there.

but Jeremy made me realise that in the absence of a Message-ID
convention, the client needs to do XHDR Content-SHA1-Tree to identify
the parts, which will give him a lot more data than he really needs if
he only wants a few files.  a separate header for the root hash might
be a good idea for that reason.

>   I don't do mime.  But, I was just looking at the
>   "content-disposition" RFC and it looks like the entire point of
>   the header is to specify display symantics. (i.e. data should be
>   displaied in-line vs as an attachement).
>   
>   Putting important content information that just seems completley
>   wrong.

interesting point.

>   > so far, I've had little success, people want
>   > to do Content-Type: application/fragment,
>   
>   It seems to me that putting it there assume that the mime tool
>   isn't going to deal with the fragment. It's just going to pass the
>   data to some external application which knows how to deal with
>   "fragments".  If that in fact is how it would be done, then the
>   important meta data like the Signature and the full file size and
>   the segment offset and size would be embeded in the data and not
>   in the mime headers.
>   
>   > which I think is a horrible
>   > layering violation (this was Jeremy's suggestion as well, a year ago).
>   > it's interesting to note that there is no requirement to have an
>   > approved RFC to register a new parameter for Content-Disposition, it
>   > suffices to present a description for its semantics to IANA.  it's
>   > more important to convince Chris Morse than the MIME crowd, if you
>   > know what I'm saying.
>   
>   I don't know who Chris Morse is so no I don't know what you mean.  But
>   that's not really important anyhow.
>   
>   This touches on the issues of "doing it right", vs "squezing it
>   into a cornor somewhwhere just to make it work".
>   Content-Disposition might just happen to be a free corner you can
>   stick crap in easily instead of doing it right.

hey!  I believe Content-Disposition is "doing it right".  well,
actually, I would prefer message/fragment, but that requires more work
to get accepted in MIME, and it also has less applicability for
non-MIME messages.

>   It gets to the point of trying to decide if "doing it right" is
>   really important enough to justify.  We can make usenet work fine
>   without MIME.

I'm not sure about that.

>   So the issue is, is this important enough for e-mail and MIME to
>   get it done "right"?

I think so.

>   Encoding it as number is natural if the data fits in an "int"
>   which the 160 bit hash doesn't.  If it doesn't fit in an int, then
>   encoding it as an array of bytes using the standard MIME base64
>   algorithm for encoding byte data seems more natural to me.

how large is your int?  we're talking about multi-gigabyte files here.

>   For the numeric values, I used big-endian and did buffer it.

yeah, network order is big-endian.

>   I don't know how SHA1 is defined in the standards, but in the code
>   I used, it was defined as an array of bytes (unsigned char
>   digest[20]), not as a 160 bit number.  So you first have to define
>   big vs little endian conversion to define how the 160 bit number
>   is constructed from those 20 bytes, then, when converting to
>   BASE64, you have to define how base64 numbers are output.  If you
>   think about it as a number, then you want to follow the normal
>   convention and and output the high-order base64 "digits" first (on
>   the left).
>   
>   But, since it's already an array of bytes and not a number, I
>   think it's more obvious (particually in MIME) to output it just
>   like you would output a 20 byte file which was BASE64 encoded.

good point.

>   [...] where leading "zeros" (which is actually A in the MIME
>   base64 alphabet) [...]

yeah, isn't that annoying?  I wonder what the rationale for that was.

>   Yeah, it's not the computation overhead, it's that a news/file
>   server which is designed from the ground up to store xBin data
>   would use the xBin hash block size it's basic unit of storage.  It
>   would have an interface which would allow you to store and fetch
>   individual blocks from any xbin-id file.  (STORE <file-id>
>   <blocknumber>, and GET <file-id> <blocknumber>).  It would be a
>   serious efficency issue if you have to store 22500 byte blocks in
>   this file system instead of power-of-two blocks.  To make that
>   work nicely in the future, I'm thinking something like 32K blocks
>   would be better.  But is making things worse for uuencode now
>   going to prevent us from every getting to the point where we would
>   want to build this xBin file system in the future?  Maybe.

we still don't know of any uudecode implementations which has a
problem with short lines ...

>   I think we are getting closer.  The signature header is starting
>   to feel like it fits in MIME to me now.

glad to hear it :)

>   Ok, but Content-Disposition just seems the wrong place to put this
>   data (it has nothing to do with display issues) which seems to me
>   belongs more in something like Content-Type.  Has MIME used
>   Content-Disposition for any thing else like this which really
>   belongs in Conetent-Type?

I don't think fragment information is more inappropriate for
Content-Disposition than the filename.

>   The Content-X is sounding good now.  But you haven't sold me on
>   the idea that using Content-Disposition would be good.  It really
>   feels to me like it needs to be done in the Content-Type: though I
>   don't know if it's possible at this late point in the development
>   of MIME because what I'm talking about is something which I think
>   would break most MIME systems if it's done how I'm thinking.

perhaps message/fragment is more viable than I first thought.  we'll
see.

>   Something like:
>   
>     Content-Type: fragment/image/jpg; segment-offset=XXXX segment-size=YYY

that breaks too much with current practice, I think.  there's also the
problem that keywords aren't passed reliably to the helper
application.

-- 
Kjetil T.			|  read and make up your own mind
				|  http://www.cactus48.com/truth.html
Technical Details
Message-ID: <1radhv3jxj.fsf@vingodur.ifi.uio.no>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.e.nsc.no!nsc.no!nextra.com!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail
References: <1r3co0fjr2.fsf@vingodur.ifi.uio.no> <20030118143342.130$IV@newsreader.com> <1ru1g6j7o4.fsf@fjorir.ifi.uio.no> <20030119023525.732$LI@newsreader.com>

Show Full Headers
Complete Article Headers
Message-ID: <1radhv3jxj.fsf@vingodur.ifi.uio.no>
Subject: Re: Content-SHA1-Tree
Date: Mon, 20 Jan 2003 15:44:24 +0000
From: Kjetil Torgrim Homme <kjetilho@haey.ifi.uio.no>
References: <1r3co0fjr2.fsf@vingodur.ifi.uio.no> <20030118143342.130$IV@newsreader.com> <1ru1g6j7o4.fsf@fjorir.ifi.uio.no> <20030119023525.732$LI@newsreader.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed1.e.nsc.no!nsc.no!nextra.com!uio.no!nntp.uio.no!ifi.uio.no!not-for-mail
Newsgroups: news.software.nntp
Organization: Dept. of Informatics, Univ. of Oslo, Norway
Lines: 180
NNTP-Posting-Host: vingodur.ifi.uio.no
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: maud.ifi.uio.no 1043077465 24454 129.240.68.200 (20 Jan 2003 15:44:25 GMT)
X-Complaints-To: abuse@ifi.uio.no
NNTP-Posting-Date: 20 Jan 2003 15:44:25 GMT
User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7