[BitTorrent] Are metainfo files (.torrent) text files ?

skybuckflying skybuck2000 at hotmail.com
Mon Nov 22 03:06:51 EST 2004


I am working with this document to implement some bittorrent stuff ;)


The first line reads:

"All data in a metainfo file is bencoded"

This leads me to believe that these files are "text" files.

The only thing that is a bit unclear is this field:

"pieces: string consisting of the concatenation of all 20-byte SHA1 
hash values, one per piece (raw binary encoded)"

There is also a note about it:

"Each piece has a corresponding SHA1 hash of the data contained 
within that piece. These hashes are concatenated to form the pieces 
value in the above info dictionary. Note that this is not a list but 
rather a single string. The length of the string must be a multiple 
of 20 bytes"

It is unclear to me how these "bytes" need to be encoded.

It says "raw binary encoded"... what is that ???

What is clear to me is that it's a big string.

For example suppose I have these 4 bytes

255, 127, 64, 8.

How would I have to encoded them into this big string.

Some possibilities:

1. "255127648"

Ofcourse this couldn't work since it could be 25,51,2,7,48 anything 
really :)

2. "11010101010101010111101011"

Some kind of bit stream ?

3. "00A5FF06"


3.1 "$00$A5$FF"  

Some variation

3.2 "0x000xA50xFF"

Another variation

4 "255 127 64 8"

Spaces in between


One last possibility is that metainfo files are not text files.

Only the first part is "text" and then the pieces section is binary ?

If that's the case then this line isn't true ofcourse:

"All data in a metainfo file is bencoded""

Then this would have to be changed to

"All data in a metainfo file is bencoded, except the pieces 
section ;)"


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!

Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    BitTorrent-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the BitTorrent mailing list