c# - Calculating info_hash from UrlEncoded query string -
Actually, I'm making a small tracker for experimental purposes, I've got quite far away, and now on the announcement part I am working.
I do not know exactly how I should define the information_hash query string.
Specification, this is an urlencoded 20-byte SHA1 hash , which has written this code to me,
byte [] foo = encoding .Default.GetBytes (HttpUtility UrlDecode (infoHash)); String temp = ""; Forrest (Byte B in AFU) {temp + = b.ToString ("X"); }
which gives the following value to 'temporary',
5D3F3F3F3F5E3F3F3F153FE4033683F55693468
The first and last few letters are correct. This is raw information,
% 5d% 96% b6% f6% 84% 5e% ea% da% c5% 15% c4% 0e% 403h% b9Ui4h
And this is what both uTorrent and my own tracker gives me information as a file when it is generated from the torrent file,
5D96B6F6845EEADAC515C40E403368B955693468
What am I doing wrong?
The URL code returns a string, but if the SHA1 hash does not understand the (ANSI) string in the form of.
Without roundtrip for string, you want to decode the input string directly into a byte array.
code
Comments
Post a Comment