5

I was wondering if someone knows what a "hash" in a BitTorrent client is referring to, it is clearly not the hashcode of the file, but something different.

I think thats more a magnet link to a file, but how is this connected to the file itself?

I just want to understand the construct behind the scene.
File <--> Hash <---> hash in torrent client

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
Emetiel
  • 1,285
  • 1
  • 10
  • 9

1 Answers1

10

The hash in a torrent client or the hashyou find in a magnet-URI is the SHA1-hash of the raw bencoded info-dictionary-part of a torrent-file.

To understand how that works you need to know two things:

  • How a torrent-file is built.

  • How bencodeing is done.

Both of these are explained in the offical bittorrent specification that you can find here: http://bittorrent.org/beps/bep_0003.html

However I recommed that you instead read the inoffical specification that you can find here: https://wiki.theory.org/BitTorrentSpecification
as it is much easier to understand.

Encombe
  • 2,003
  • 1
  • 17
  • 26
  • To get the real file from the torrent that has the hash value of the Info_hash. – Emetiel Feb 19 '15 at 10:22
  • To get the real file from the torrent that has the hash value of the Info_hash delete everything bevor "d5:files" and after "Æá67:privatei0ee". 9ee4:info|<-- Delete d5:filesld6:lengthi10 ...... // .... 67:privatei0ee Delete ->|22:rtorrent_meta_ – Emetiel Feb 19 '15 at 10:31