Torrent info_hash参数 [英] The torrent info_hash parameter

查看:275
本文介绍了Torrent info_hash参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算 info_hash参数?也就是与信息词典对应的哈希值

官方规格:


info_hash
来自元信息文件的信息值的bencode形式的20字节sha1散列。请注意,这是元信息文件的子字符串。
这个值几乎肯定会被转义。


这是否意味着只需从meta-info文件中获取子字符串并对代表性字节做一个sha-1哈希值。

....因为这是我如何尝试12次但没有成功的意思我已经比较了结果散列与一个我应该最终与..和他们不同..that +跟踪器的反应是失败,未知的洪流...或什么的一切。所以你如何计算info_hash?

解决方案

bdecode图元文件,然后它只是sha1(bencode(metadata ['info'])) bencode只有信息字典再次,然后哈希)。


How does one calculate the info_hash parameter? Aka the hash corresponding to the info dictionar??

From official specs:

info_hash The 20 byte sha1 hash of the bencoded form of the info value from the metainfo file. Note that this is a substring of the metainfo file. This value will almost certainly have to be escaped.

Does this mean simply get the substring from the meta-info file and do a sha-1 hash on the reprezentative bytes??

.... because this is how i tried 12 times but without succes meaning I have compared the resulting hash with the one i should end up with..and they differ ..that + tracker response is FAILURE, unknown torrent ...or something

So how do you calculate the info_hash?

解决方案

bdecode the metafile, then it's simply "sha1(bencode(metadata['info']))" (i.e. bencode only the info dict again, then hash that).

这篇关于Torrent info_hash参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆