抱歉代码有些丑陋,以下是计算种子哈希的代码。我运行这段代码时得到的结果与在Transmission中直接打开该种子时得到的结果不同:
我正在测试r_000页面上的内容:http://gen.lib.rus.ec/repository_torrent/ Transmission给出的结果为:63a04291a8b266d968aa7ab8a276543fa63a9e84
我的代码给出的结果为:1882ff6534ee4aa660e2fbf225c1796638bea4c0
有任何想法是我搞砸了什么吗?谢谢!
我正在测试r_000页面上的内容:http://gen.lib.rus.ec/repository_torrent/ Transmission给出的结果为:63a04291a8b266d968aa7ab8a276543fa63a9e84
我的代码给出的结果为:1882ff6534ee4aa660e2fbf225c1796638bea4c0
import bencoding
from io import BytesIO
import binascii
import hashlib
with open("cache/r_000.torrent", "rb") as f:
data = bencoding.bdecode(f.read())
info = data[b'info']
hashed_info = hashlib.sha1(info[b'pieces']).hexdigest()
print(hashed_info)
有任何想法是我搞砸了什么吗?谢谢!