Open charles2910 opened 2 years ago
Upon further analysis, we can break down this work in a handful of parts. These parts are listed below with important points of each part.
The torrent file uses a specific enconding known as bencode and it has mandatory fields as well as some optional ones.
The explanation and text below were adapted from the unoficial BitTorrent Specification.
Bencoding is a way to specify and organize data in a concise format. It supports the following types: byte strings, integers, lists, and dictionaries.
Byte strings are encoded as follows:
Integers are encoded as follows: i
Lists are encoded as follows: l
Dictionaries are encoded as follows: d
The content of a metainfo file (the file ending in ".torrent") is a bencoded dictionary, containing the keys listed below. All character string values are UTF-8 encoded.
Note that some fields were left off for brevity.
This section contains the dictionary structure for the "single file" mode.
Note:
I've found 2 libraries that can be used for generating the torrent files. They are:
To give a better example of the torrent file, I've created a test torrent. The high level (fields and values) will be shown together with the bencoded resulting file.
{
'info': {
'length': 223,
'name': 'teste.c',
'piece length': 16384,
'pieces': b'\x9dz\x12\x90\xe4\xfdK\xec\x1b_\xb28\xc6/\xab\x87\xd1\x9c\x1cc'
},
'created by': 'Charles',
'comment': 'This is a test torrent file',
'creation date': 1635279024
}
d7:comment27:This is a test torrent file10:created by7:Charles13:creation datei1635279024e4:infod6:lengthi223e4:name7:teste.c12:piece lengthi16384e6:pieces20:\x9dz\x12\x90\xe4\xfdK\xec\x1b_\xb28\xc6/\xab\x87\xd1\x9c\x1ccee
As one part of allium, we will implement the anonymous file sharing system proposed in the Riffle article. It's described in section 5 of the paper and it consists of 3 main parts: