当我想向跟踪器发送初始请求时,我所见过的所有引用都需要进行网址编码。 如果我将信息密钥的SHA-1散列转换为十六进制字符串,为什么需要对散列进行网址编码? 它只包含允许的字符。
When I want to send an initial request to a tracker all references I've seen says it needs to be url-encoded. If I transform the SHA-1 hash I have of the info key into a hex string, why would I need to url-encode the hash? It only contains allowed characters.
最满意答案
info_hash参数不是十六进制字符串。 这是一个纯粹的二进制字符串,所以是的,你将不得不对其中的许多字节进行URL编码。 (这最终会使得它比使用十六进制编码的字符串更长,但这是您的BitTorrent协议,现在已经太迟了,无法做任何事情!)
The info_hash parameter is not a hex string. It's a pure binary string, so yes, you will have to URL-encode many of the bytes in it. (This tends to make it longer in the end than just using a hex-encoded string, but that's the BitTorrent protocol for you, too late to do anything about it now!)
更多推荐
发布评论