问题
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.
回答1:
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!)
回答2:
Binary form of info-hash (a 20 byte long SHA1) should be URL encoded. AFAIK some trackers accept pure hexadecimal info-hash (40 character long string).
来源:https://stackoverflow.com/questions/4072234/bittorrent-tracker-request-format-of-info-hash