2014-03-02 48 views
1

我正在尝试向跟踪器发送HTTP获取请求。但我不知道info_hash和peer_id在哪里,我需要它们作为参数。根据bittorent规范,info_hash是元文件信息“info_hash:来自Metainfo文件的info密钥的值的urlencoded 20字节SHA1哈希”,并且peer_id“允许为任何值”发送HTTP到Bittorent跟踪器 - info_hash和peer_id在哪里?

但是当我把正确的URL编码信息密钥作为info_hash,并任意为peer_id放置一些东西我得到这个错误: d14:失败的原因20:Torrent unauthorisede

有人可以给我一个例子,其中info_hash在这个文件?

d8:announce40:http://tracker.the123ay.org/announce13:announce-listll40:http://tracker.th213bay.org/announceel35:udp://tracker.op123rrent.com:80el23:udp://tr123ker.ccc.de:80el29:udp://tracker.pawscbt.com:80el46:udp://tracker.tntvadse.scambioetico.org:2710ee7:comment46:Torrent downloaded from http://theadsde10:created by13:uTorrent/332013:creation datei1391719112e8:encoding5:UTF-84:infod13:file-durationli2462ei2474ee10:file-mediali0ei0ee5:filesld6:lengthi1443259870e4:pathl70:Casdasd7.Problemi.Di.Famiglia.ITA.720p.DLMux.h264-Noasdip.mkveed6:lengthi1461542146e4:pathl70:Chicaasdasx08.Una.Scelta.Difficile.ITA.720p.DLMux.h264-NovaRip.mkveee4:name48:Chicago.Fire.1x07-08.ITA.720p.DLMux.h264-NovaRip12:piece lengthi262144e6:pieces221620: 

使用Java如果它很重要。如果我需要提供更多信息,请输入Lmk。

+0

还有什么不知道一个很好的答案info_hash在哪里 –

回答

0

在您的示例中的信息词典开始于

infod13:

您必须确定的信息数据,并计算信息数据的SHA1。之后,您必须对SHA1进行网址编码。

info_hash: urlencoded 20-byte SHA1 hash of the value of the info key from the Metainfo file. Note that the value will be a bencoded dictionary, given the definition of the info key above.

description

有写在Qt的一个例子,我认为它可以帮助你。 (Qt5.2.1/5.2.1/gcc_64 /例子/网络/种子) 你可以在网上找到这里qt torrent

编辑:这是你正在寻找Calculating the info-hash of a torrent file