BT seed file format

Source: Internet
Author: User
Tags sha1 hash

BT seed file format

The BT seed file uses a bencoding encoding method to save data.
There are four types of bencoding data: srings (string), integers (integer), lists (list), dictionaries (dictionary)
The encoding rules are as follows:
Strings (string) encoding: <String Length >:< string>
For example, 4: test indicates the string "test"
4: The example is the string "example"
String Length in bytes
No start or end mark

Integers (integer) is encoded as: I <integer> E
Start to mark I, end to Mark E
For example, i1234e indicates an integer of 1234.
I-1234e represents an integer-1234
No integer size limit
I0e is an integer of 0.
Illegal i-0e
The value starting with 0 is invalid. For example, the value of i01234e is invalid.

Lists (list) encoding: L <bencoding encoding type> E
Start to L, end to E
The list can contain any bencoding encoding type, including integers, strings, lists, and dictionaries.
For example, L4: test5abcdee represents two strings ["test", "ABCDE"]

Dictionaries (dictionary) is encoded as D <bencoding string> <bencoding encoding type> E
Mark start as D and end as E
The keyword must be a bencoding string.
The value can be of any bencoding encoding type.
For example, D3: agei20ee indicates {"Age" = 20}
D4: path3: C:/8: filename8: test.txt E: {"path" = "C:/", "FILENAME" = "test.txt "}

The file structure is as follows:
All content must be of the bencoding encoding type.
The entire file is a dictionary structure that contains the following keywords:
Announce: the URL of the tracker server (string)
Announce-List (optional): List of backup tracker servers (list)
Creation date (optional): Specifies the seed creation time. It is a UNIX standard time format. The number of seconds from 00:00:00, January 1, 1970 to the creation time (integer)
Comment (optional): Remarks (string)
Created by (optional): Information of the creator or program (string)
Info: a dictionary structure that contains the main information of a file. There are two types of information: single file structure or multi-file structure.
The structure of a single file is as follows:
Length: file length, in bytes (integer)
Md5sum (optional): MD5 checksum of a 32-character file. BT does not use this value, but it is reserved for compatibility with some programs! (String)
Name: File Name (string)
Piece length: the size of each block, in bytes (integer)
Pieces: The sha1 hash value of 20 bytes for each block (in binary format)
The structure of multiple files is as follows:
Files: a dictionary structure
Length: file length, in bytes (integer)
Md5sum (optional): same as that in the single file structure
Path: the file path and name. It is a list structure. For example, the/test/test.txt list is L4: test8test.txt E.
Name: the name of the top-level directory (string)
Piece length: same as in a single file structure
Pieces: same as in the single file structure
Instance:
Use NotePad to open a. torrent file.
D8: announce35: http://www.manfen.net: 7802/announce13: Creation datei000066750000e4: infod6: lengthi17799e4: name62: MICROSOFT.WINDOWS.2000.AND.NT4.SOURCE.CODE-SCENELEADER. tor000012: piece lengthi32768e6: pieces20 :? W? Why? Snapshot row T snapshot EE

It is easy to see
Announce = http://www.manfen.net: 7802/announce
Creation date = 1076675108 seconds (02/13/04 20:25:08)
File name = MICROSOFT.WINDOWS.2000.AND.NT4.SOURCE.CODE-SCENELEADER. torrent
File size = 17799 bytes
File block size = 32768 bytes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.