I'm having an issue to understand how can I "translate" the info_hash value to a real hash. Here's an example of what I'm getting from uTorrent when it's announcing to my tracker:
{
passkey: "77ec6a27adcc441648d66d0b873550e4",
info_hash: "YNvÿ@p",
peer_id: "-UT3430-89 ",
port: "54790",
uploaded: "0",
downloaded: "491520",
left: "24928863",
corrupt: "0",
key: "A2DD5E96",
numwant: "200",
compact: "1",
no_peer_id: "1"
}
What I'm trying to understand is how do I take this strange value: "YNvÿ@p" and get the info hash as sha1 (like: 594E98760099B1CFC3BFAA4070C0CC02F6C1AA90)? I'm using PHP on my server.
Now I've read already the following statements:
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. The info-hash must be the hash of the encoded form as found in the .torrent file, regardless of it being invalid. This value will almost certainly have to be escaped.
But it didn't help me much to understand what's going on.
OK, I found the solution for that. For some reason, $_GET in PHP (we use CodeIgniter) won't get the full binary data, it looked like it was stripping it for some reason. And what's it left is only 'YNvÿ@p', but in matter of fact there were few more unknown binary symbols that got thrown on the way.
So... what I did is to get the full URL parameters is:
And then, I got this value in the 'info_hash' key:
Afterwards I just did this action:
And got a full hash!
@Sammitch, Thank you for pointing me to correct direction on this matter!