[bittorrent] Bittorrent peer_id ASCII and Unicode?
coderjoe at grnet.com
Mon Mar 13 12:55:57 EST 2006
On Mon, Mar 13, 2006 at 09:09:47AM +0100, Olaf van der Spek wrote:
> On 3/13/06, bac15 at uakron.edu <bac15 at uakron.edu> wrote:
> > Does anyone know if uTorrent uses Unicode for part of its peer_id? When
> > bdecoding the peer list returned from the tracker, all peers and their
> > information appear to
> > be probably encoded. But, the bdecoding fails on a given uTorrent peer_id. I
> > believe the peer_id is suppose to be a 20 byte string used as a (per client)
> > unique identifier. Here is an example of what is happening:
> > Connecting to:
> > http://torrent.centos.org:6969/announce?info_hash=q%00*k%de%c2%e7f%d3%c9Z7%88%bd%c4%08%83%08%d6_&peer_id=-BT1000-400326084821&port=6881&uploaded=0&downloaded=0&left=2438914304&uploaded=stopped
> > Response:
> > d8:completei9e10:incompletei1e8:intervali1800e5:peersld2:ip13:18.104.22.1687:peer
> > id20:M4-0-1--d936f6f5d3a14:porti6881eed2:ip13:22.214.171.1247:peer
> > id20:M4-0-4--b0d83d5c59634:porti6881eed2:ip13:126.96.36.199:peer
> > id20:-UT1500-�����tƓǎ�4:porti32459eed2:ip13:188.8.131.527:peer
> > id20:-AZ2400-W7ajaR6Lht7l4:porti49152eed2:ip12:184.108.40.2067:peer
> > id20:-AZ2400-NbSKguVXZGek4:porti6881eeee
> > All the other clients appear to be using the Azureus-style or Shadow-style
> > peer_id convention. Is bencoding restricted to only ASCII characters, or can
> > there be Unicode characters in it as well? Thanks for the help.
the "string" type in bencoding is not restricted at all. it can contain
an arbitrarily long sequence of any value that can be stored in a byte.
Additionally, the requirements for the peerid only require it to be
a 20-byte long unique value. it doesn't even have to be alphanumeric.
Being restricted to alphanumeric characters was a restriction that the
various client authors created. If I remember correctly, initial
versions of the mainline client used a SHA1 hash of a string created by
concatinating your ip address, the port the client is listening on, and a
number from the pseudorandom number generator.
> 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
More information about the BitTorrent