torrent là gì

Torrent files
Filename extension


Bạn đang xem: torrent là gì

Internet media type


StandardBEP-0003 (v1),[1] BEP-0052 (v2)[2]

In the BitTorrent tệp tin distribution system, a torrent file or meta-info file is a computer tệp tin that contains metadata about files and folders lớn be distributed, and usually also a list of the network locations of trackers, which are computers that help participants in the system find each other and khuông efficient distribution groups called swarms.[1] A torrent tệp tin does not contain the nội dung lớn be distributed; it only contains information about those files, such as their names, thư mục structure, sizes, and cryptographic hash values for verifying tệp tin integrity. Torrent files are normally named with the extension ".torrent".

A torrent tệp tin acts lượt thích a table of contents (index) that allows computers lớn find information through the use of a BitTorrent client. With the help of a torrent tệp tin, one can tải về small parts of the original tệp tin from computers that have already downloaded it. These "peers" allow for downloading of the tệp tin in addition lớn, or in place of, the primary server.

The BitTorrent system has been created lớn ease the load on central servers, as instead of having individual clients fetch files from the server, BitTorrent can crowd-source the bandwidth needed for the tệp tin transfer and reduce the time needed lớn tải về large files. Many free/freeware programs and operating systems, such as the various Linux distributions offer a torrent tải về option for users seeking the aforementioned benefits. Other large downloads, such as truyền thông media files, are often torrented as well.


Typically, Internet access is asymmetrical, supporting greater tải về speeds phàn nàn upload speeds, limiting the bandwidth of each tải về, and sometimes enforcing bandwidth caps and periods where systems are not accessible. This creates inefficiency when many people want lớn obtain the same mix of files from a single source; the source must always be online and must have massive outbound bandwidth. The BitTorrent protocol addresses this by decentralizing the distribution, leveraging the ability of people lớn network "peer-to-peer", among themselves.

Each tệp tin lớn be distributed is divided into small information chunks called pieces. Downloading peers achieve high tải về speeds by requesting multiple pieces from different computers simultaneously in the swarm. Once obtained, these pieces are usually immediately made available for tải về by others in the swarm. In this way, the burden on the network is spread among the downloaders, rather phàn nàn concentrating at a central distribution hub or cluster. As long as all the pieces are available, peers (downloaders and uploaders) can come and go; no one peer needs lớn have all the chunks or lớn even stay connected lớn the swarm in order for distribution lớn continue among the other peers.

A small torrent tệp tin is created lớn represent a tệp tin or thư mục lớn be shared. The torrent tệp tin acts as the key lớn initiating downloading of the actual nội dung. Someone interested in receiving the shared tệp tin or thư mục first obtains the corresponding torrent tệp tin, either by directly downloading it or by using a magnet liên kết. The user then opens that tệp tin in a BitTorrent client, which automates the rest of the process. In order lớn learn the mạng internet locations of peers who may be sharing pieces, the client connects lớn the trackers named in the torrent tệp tin, and/or achieves a similar result through the use of distributed hash tables. Then the client connects directly lớn the peers in order lớn request pieces and otherwise participate in a swarm. The client may also report progress lớn trackers, lớn help the tracker with its peer recommendations.

When the client has all the pieces, the BitTorrent client assembles them into a usable khuông. They may also continue sharing the pieces, elevating their status lớn that of seeder rather phàn nàn an ordinary peer.

File structure[edit]

A torrent tệp tin contains a list of files and integrity metadata about all the pieces, and optionally contains a large list of trackers.

A torrent tệp tin is a bencoded dictionary with the following keys (the keys in any bencoded dictionary are lexicographically ordered):

  • announce—the URL of the tracker
  • info—this maps lớn a dictionary whose keys are dependent on whether one or more files are being shared:
    • files—a list of dictionaries each corresponding lớn a tệp tin (only when multiple files are being shared). Each dictionary has the following keys:
      • length—size of the tệp tin in bytes.
      • path—a list of strings corresponding lớn subdirectory names, the last of which is the actual tệp tin name
    • length—size of the tệp tin in bytes (only when one tệp tin is being shared though)
    • name—suggested filename where the tệp tin is lớn be saved (if one file)/suggested directory name where the files are lớn be saved (if multiple files)
    • piece length—number of bytes per piece. This is commonly 28 KiB = 256 KiB = 262,144 B.
    • pieces—a hash list, i.e., a concatenation of each piece's SHA-1 hash. As SHA-1 returns a 160-bit hash, pieces will be a string whose length is a multiple of đôi mươi bytes. If the torrent contains multiple files, the pieces are formed by concatenating the files in the order they appear in the files dictionary (i.e., all pieces in the torrent are the full piece length except for the last piece, which may be shorter).

All strings must be UTF-8 encoded, except for pieces, which contains binary data.

A torrent is uniquely identified by an infohash, a SHA-1 hash calculated over the contents of the info dictionary in bencode khuông. Changes lớn other portions of the torrent does not affect the hash. This hash is used lớn identify the torrent lớn other peers via DHT and lớn the tracker. It is also used in magnet links.

BitTorrent v2[edit]

The BitTorrent v2 protocol (BEP-0052) introduces a new definition of the torrent tệp tin.[2] The basic structure is:

  • announce—the URL of the tracker
  • info—this maps lớn a dictionary whose keys are dependent on whether one or more files are being shared:
    • name—suggested directory name where the files are lớn be saved
    • piece length—number of bytes per piece. This is commonly 28 KiB = 256 KiB = 262,144 B. In v2, it must be a power of 2.
    • meta version—number, "2".
    • file tree—a tree of dictionaries. Each key represents a directory name or a tệp tin name. The tệp tin is
      • length—size of the tệp tin in bytes (only when one tệp tin is being shared though)
      • piece root—For non-empty files this is the root hash of a merkle tree with a branching factor of 2, constructed from 16KiB blocks of the tệp tin.
  • piece layers—A dictionary of strings, containing the new type of merkle root hashes for each piece.

The new format uses SHA-256 in both the piece-hashing and the infohash, replacing the broken SHA-1 hash. The "btmh" magnet liên kết would contain the full 32-byte hash, while communication with trackers and on the DHT uses the 20-byte truncated version lớn fit into the old message structure.[2] It is possible lớn construct a torrent tệp tin with only updated new fields for a "v2" torrent, or with both the old and new fields for a "hybrid" format. However, as a torrent would have different infohashes in v1 and v2 networks, two swarms would khuông, requiring special handling by the client lớn merge the two. In addition, as v2 adds keys lớn info, there can be no [3]

A core feature of the new format is its application of merkle trees, allowing for 16KiB blocks of a piece lớn be individually verified and re-downloaded. Each tệp tin now always occupy whole piece sizes and have an independent merkle root hash, ví that it's possible lớn find duplicate files across unrelated torrent files of any piece length. The tệp tin size is not reduced (assuming piece size stays the same; v2's tree structure allows larger pieces with fewer ill effects), but the info dictionary required for magnet links are (only in v2-only torrents).[3]


A torrent tệp tin can also contain additional metadata defined in extensions lớn the BitTorrent specification.[4] These are known as "BitTorrent Enhancement Proposals." Examples of such proposals include metadata for stating who created the torrent, and when.

Accepted extensions[edit]

These extensions have been deployed in one or more implementations as well as having been proven useful through consistent and widespread use. While they may require minor revisions, they are largely considered lớn be complete, only awaiting the blessing of Bram Cohen in order lớn be elevated lớn the status of Final/Active Process.

Distributed hash tables[edit]

BEP-0005[5] extends BitTorrent lớn tư vấn distributed hash tables, specifically Mainline DHT.

A trackerless torrent dictionary does not have an announce key. Instead, a trackerless torrent has a nodes key:

{ # ... 'nodes': [["<host>", <port>], ["<host>", <port>], ...], # ... }

For example,

'nodes': [["", 6881], ["your.router.node", 4804]],

The specification recommends that nodes "should be mix lớn the K closest nodes in the torrent generating client's routing table. Alternatively, the key could be mix lớn a known good node such as one operated by the person generating the torrent."

Multiple trackers[edit]

Xem thêm: moodle là gì

BEP-0012[6] extends BitTorrent lớn tư vấn multiple trackers.

A new key, announce-list, is placed in the top-most dictionary (i.e., with announce and info)

{ # ... 'announce-list': [['<tracker1-url>']['<tracker2-url>']], # ... }

HTTP seeds[edit]

BEP-0019[7] is one of two extensions allowing HTTP seeds lớn be used in BitTorrent.

In BEP-0019, a new key url-list, is placed in the top-most list. The client uses the links lớn assemble ordinary HTTP URLs – no server-side tư vấn is required. This feature is very commonly used by open source projects offering software downloads. Web seeds allow smart selection and simultaneous use of mirror sites, P2P or HTTP(S), by the client. Doing ví reducing the load on the project's servers while maximizing tải về tốc độ. MirrorBrain [de] automatically generates torrents with trang web seeds.

Private torrents[edit]

BEP-0027[8] extends BitTorrent lớn tư vấn private torrents.

A new key, private, is placed in the info dictionary. This key's value is 1 if the torrent is private:

{ # ... 'info': { # ... 'private': 1, # ... }, # ... }

Private torrents are lớn be used with a private tracker. Such a tracker restricts access lớn torrents it tracks by checking the peer's IP, refusing lớn provide a peer list if the IP is unknown. The peer itself is usually registered lớn the tracker via a gated online community; the private tracker typically also keep statistics of data transfer for use in the community.

Decentralized methods lượt thích DHT, PeX, LSD are disabled lớn maintain the centralized control. A private torrent can be manually edited lớn remove the private flag, but doing ví will change the info-hash (deterministically), forming a separate "swarm" of peers. On the other hand, changing the tracker list will not change the hash. The flag does not offer true privacy, instead operating as a gentlemen's agreement.

Draft extensions[edit]

These extensions are under consideration for standardization. Most are already widely adopted as de facto standards.

HTTP seeds[edit]

BEP-0017[9] extends BitTorrent lớn tư vấn HTTP seeds, later more commonly termed "web seeds" lớn be inclusive of HTTPS.

In BEP-0017, a new key, httpseeds, is placed in the top-most list (i.e., with announce and info). This key's value is a list of trang web addresses where torrent data can be retrieved. Special server tư vấn is required. It remains at Draft status.

{ # ... 'httpseeds': ['', ''], # ... }

Merkle trees[edit]

BEP-0030[10] extends BitTorrent lớn tư vấn Merkle trees (originally implemented in Tribler). The purpose is lớn reduce the tệp tin size of torrent files, which reduces the burden on those that serve torrent files.

A torrent tệp tin using Merkle trees does not have a pieces key in the info list. Instead, such a torrent tệp tin has a root_hash key in the info list. This key's value is the root hash of the Merkle hash:

{ # ... 'info': { # ... 'root hash': <binary SHA1 hash>, # ... }, # ... }

BitTorrent v2 uses a different type of Merkel tree.[3]


Single file[edit]

A de-bencoded torrent tệp tin (with piece length 256 KiB = 262,144 bytes) for a tệp tin debian-503-amd64-CD-1.iso (whose size is 678 301 696 bytes) might look like:

{ 'announce': '', 'info': { 'length': 678301696, 'name': 'debian-503-amd64-CD-1.iso', 'piece length': 262144, 'pieces': <binary SHA1 hashes> } }

Note: pieces here would be a 51 KiB value ().

Multiple files[edit]

A de-bencoded torrent tệp tin (with 'piece length' 256 KiB = 262144 B) for two files, 111.txt and 222.txt, might look like:

{ 'announce': '', 'info': { 'files': [ {'length': 111, 'path': ['111.txt']}, {'length': 222, 'path': ['222.txt']} ], 'name': 'directoryName', 'piece length': 262144, 'pieces': <binary SHA1 hashes> } }

Hybrid, multiple files[edit]


This section is empty. You can help by adding lớn it. (February 2023)

Xem thêm: make up my mind nghĩa là gì

See also[edit]

  • Glossary of BitTorrent terms
  • Magnet links


External links[edit]

  • Official BitTorrent Specification
  • BitTorrent Definition