2014-03-02 49 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