How to Examine .torrent File?

In this article, we will discuss about .torrent file. It is difficult to view to contents of a .torrent file using conventional document or text manipulation software like Microsoft Word and Notepad, so we use Torrent File Editor software for Windows Operating System to see the contents.

According to Wikipedia, a torrent file is a bencoded dictionary with the following keys (the keys in any bencoded dictionary are lexicographically ordered). This file contains metadata that helps to download another file/folder to which it is associated. The file is in a dictionary form. Below is a screenshot to demonstrate the raw content of a torrent file.

examine torrent file raw content

Also, have a look at the tree view of the torrent file for better understandability.

gfgexample-torrent-treeview



See the dictionary format of the above file content. We will discuss the highlighted fields of the first screenshot.

announce: The announce field points to the tracker of the content file(s) that we are uploading as a torrent. This is a ‘UDP tracker protocol’. Note that the above value of ‘announce’ is of the form udp://exampletracker.com:port. This syntax might change depending on different torrent clients and different tracker providers.

What is a tracker?: As the name suggests, it helps peers to find each other on the network. When a node wants to download a torrent file, the tracker responds with the list of nodes that have the desired file and also, registers the requesting node for other nodes to see.

comment: Comment about the torrent file added by the creator of the torrent. See below to know how they are added at the creation of a torrent.

gfg example add comment

created by: Creater of the torrent. A string type.

creation date: Timestamp in seconds. For example, the timestamp in the top image converts to Tuesday, December 3, 2019 8:51:22 PM GMT+05:30

info: Contains length and path of file(s) as separate objects; one for each file.

info.files[i].length: Length of the file in Bytes.

info.files[i].path: An array of strings which denotes the subdirectory names.

name: Name of the torrent file.

piece length: It denotes the length of one piece, generally 28KB.

pieces: It denotes each piece’s SHA-1 hash, stored in a hash list. Its always a multiple of 160-bits as output of SHA-1 is 160-bits. In UTF-8 encoding, it is something like this(totally unreadable).

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.