[bittorrent] Bittorrent peer_id ASCII and Unicode?

Brett Cooper bac15 at uakron.edu
Tue Mar 14 15:06:19 EST 2006


Olaf van der Spek wrote:

>On 3/13/06, Thad Ward <coderjoe at grnet.com> wrote:
>  
>
>>On Mon, Mar 13, 2006 at 07:00:40PM +0100, Olaf van der Spek wrote:
>>    
>>
>>>On 3/13/06, Thad Ward <coderjoe at grnet.com> wrote:
>>>      
>>>
>>>>>I think the common assumption is that it's restricted to bytes (0 - 0xff).
>>>>>          
>>>>>
>>>>I wouldn't say that is much of a restriction, as everything in a
>>>>computer is stored as bytes, including unicode characters. :P
>>>>        
>>>>
>>>Only if the other requirement is that of a 20 byte value. If it's a 20
>>>character value then the 0 - 0xff restriction is a real restriction.
>>>      
>>>
>>True. And unfortunately, the spec just says "Strings are length-prefixed
>>base ten followed by a colon and the string." There is no mention if
>>this is the byte length or the character length. There is also no
>>    
>>
>
>That's another issue.
>I think the encoding is supposed to be UTF-8.
>
>  
>
>>mention of a character encoding, which would mean we should treat that
>>as a byte length, and, when displaying the string, only know for sure
>>what the meanings of 0-127 are, as they are the only _standard_ set of
>>characters (well, as long as you use ASCII. I don't think many people
>>use EBCDIC, though.) "Strings" that are not really intended to be
>>displayed as is, such as the piece hash string, don't have the problem
>>of character encoding, though.
>>
>>Note that I am referring to the official spec here, not the wiki spec.
>>The wiki spec appears to be a little clearer, as it calls them "byte
>>strings".
>>_______________________________________________
>>BitTorrent mailing list
>>BitTorrent at lists.ibiblio.org
>>http://lists.ibiblio.org/mailman/listinfo/bittorrent
>>
>>    
>>
>_______________________________________________
>BitTorrent mailing list
>BitTorrent at lists.ibiblio.org
>http://lists.ibiblio.org/mailman/listinfo/bittorrent
>  
>
Thanks for all the input. Here is what I found with the uTorrent peer_id
stuff so far:
Array Index, Character, Integer value of char.
2306 - 45
2307 U 85
2308 T 84
2309 1 49
2310 5 53
2311 0 48
2312 0 48
2313 - 45
2314 � 65533
2315 � 65533
2316 � 65533
2317 ? 56579
2318 � 65533
2319 ^B 2
2320 u 117
2321 F 70
2322 I 73
2323 � 65533
It appears that some of the characters are less than or equal to 255,
but some are greater than that, say Unicode characters that are less
than equal to 2 bytes (65535). Now, if I am reading this correctly,
there would be 24 bytes (18 chars). Has anyone run into this or
something similar to this, and if so, did you find a way to work with
this or around it? Here is an example of a more normal looking peer_id
(Azureus):
2372 - 45
2373 A 65
2374 Z 90
2375 2 50
2376 4 52
2377 0 48
2378 0 48
2379 - 45
2380 T 84
2381 7 55
2382 T 84
2383 n 110
2384 s 115
2385 p 112
2386 q 113
2387 8 56
2388 O 79
2389 A 65
2390 B 66
2391 1 49
Here, there is 20 chars = 20 bytes which is what the Wiki Bittorrent
specification says. Thanks again for the help.



More information about the BitTorrent mailing list