[bittorrent] Problems connecting with tracker

Brett Cooper bac15 at uakron.edu
Fri Mar 10 17:59:55 EST 2006

Brian Dessent wrote:

>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:
>BitTorrent mailing list
>BitTorrent at lists.ibiblio.org
That seemed to work.  I guess I am just a bit rusty with CGI stuff at
the moment.  It was a bit confusing why you couldn't send the hash value
just as a normal string.  All the characters in the string would appear
to be ok values for a url, but then I realized that embedded hex code
(the hash sha1 checksum) needed to be urlencoded (even though it was
just a string).  I was simply using Java to convert hex code into a
string object and that appeared to work fine.  But, urlencoding that
string object just spit out the same string because it appears that most
urlencoders don't deal with hex, but in strings.  Anyway, I wrote a
urlencoder function for dealing with a string that consists of
hexidecimal values and that seemed to work.  Thanks again for your time
and guidance.

    - Brett

More information about the BitTorrent mailing list