[bittorrent] Problems connecting with tracker

Brian Dessent brian at dessent.net
Thu Mar 9 22:08:59 EST 2006


Brett Cooper wrote:

> there are no examples).  Now I know there is a 20 byte SHA1 hash value
> for the value of the info key.  For example,
> "84E6B5AA9F68477BE346BA762DE1A6C84CAED4EE".  Now I believe for a url

That is the 40 character ascii hexadecimal representation of a 20 byte
binary value.  So no, that's not the raw binary value.  You need to
realize that what you're working with there is an ascii representation,
it is not the raw binary value, it is in fact twice as long as the
actual binary value because it's using hexadecimal notation.

The raw hash value is 20 bytes.  Take each of those 20 bytes and
urlencode them.  The result after urlencoding a single character will
either be that character (if it lies in the allowable range) or %nn if
it does not.  If you wanted to be conservative you could just urlencode
every one, even if they lie in the printable range.  I don't see why
this is so complicated.  You can see this happening in URLs all the
time, the most common is %20 for a space.

> tracker?  It isn't making sense right now and any direction would be
> helpful.  If you could provide an example, I think it would greatly
> clarify things.  Thanks for the help.

Do a packet capture of an existing client, or look at the source code. 
The urlencoded version of the above hash would be:

%84%e6%b5%aa%9fhG%7b%e3F%bav-%e1%a6%c8L%ae%d4%ee

Brian



More information about the BitTorrent mailing list