[bittorrent] The size of XML (was: DTD for hashed files)

Joseph Ashwood ashwood at msn.com
Tue Apr 12 21:26:46 EDT 2005

----- Original Message ----- 
From: "Andrew Brampton" <andrew at bramp.freeserve.co.uk>
To: <bittorrent at lists.ibiblio.org>
Sent: Tuesday, April 12, 2005 8:15 AM
Subject: Re: [bittorrent] The size of XML (was: DTD for hashed files)

> 2) XML will break the SHA1 hashing of the info dictionary. Its perfectly 
> valid for XML to have new lines, spaces, different case, different 
> ordering, etc. All these mean the info block may look different even 
> though it represents the same data. This would mean the SHA1 torrent hash 
> would have to be made of something else. Do I hear you shout, hash just 
> the pieces. Well yes that would work, but then you lose the hashing of the 
> filenames, filesizes (which could be bad).

You are looking for Canonical XML (http://www.w3.org/TR/xml-c14n), as 
specifically used in both XML Encryption 
(http://www.w3.org/Encryption/2001/) and XML Signature 
(http://www.w3.org/Signature/) which incidently already provide everything 
else you're looking for to verify the torrent file and the external data.

> 3) Beencoding is smaller than XML. Ok, we can live with a little overhead 
> caused by the file names, file sizes, dates, etc (basically anything at 
> the top of the .torrent). Its the binary encoding of the pieces that's the 
> problem. XML as far as I know uses Base64 to encode binary data, now that 
> adds a 33% overhead instantly [1].

XOP, aka binary XML reduces this overhead substantially bringing it in line 
with the overhead of bencoding, or asn.1.

So that leaves:
> 1) Beencoding data can represent everything XML can. It might not be as 
> flexible, but it supports all the simple constructs


4) bencoded torrents are already done for Bittorrent

I'm rather format agnostic, XML doesn't offer anything extra of use for a 
bittorrent-like environment, neither does bencoding, or ASN.1, or 
proprietary binary, or just about anything else. In a way I'd actually be 
for defining a polymorphic standard just so that the encoding problem would 
go away for a while, later required, recommended, etc formats can be figured 

More information about the BitTorrent mailing list