Hash calculation in torrent clients

前端 未结 1 1045
清歌不尽
清歌不尽 2021-01-06 16:24

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.

1条回答
  •  北海茫月
    2021-01-06 16:58

    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.

    0 讨论(0)
提交回复
热议问题