[BitTorrent] Re: bencoding 0:

Olaf van der Spek OvdSpek at LIACS.NL
Tue Nov 23 04:34:16 EST 2004

Elliott Mitchell wrote:
>>From: "skybuckflying" <skybuck2000 at hotmail.com>
>>--- In BitTorrent at yahoogroups.com, Elliott Mitchell <ehem at m...> wrote:
>>>>From: Olaf van der Spek <OvdSpek at L...>
>>>>>Any string of digits is a valid string length (no one generates 
>>>>>of length 0000, but it is valid by the spec).
>>>>That's not supposed to be valid.
>>>"Strings are length-prefixed base ten followed by a colon and the 
>>>For example 4:spam corresponds to 'spam'."
>>>Sounds perfectly valid to me. Though I would support shooting 
>>anyone who
>>>created such strings by design.
>>For delphi it's no problem :)
>>ShowMessage( IntToStr( StrToInt( '000' ) ) );
>>This shows 0 :) without exceptions etc ;)
>>Though other languages might have problems converting string '0000' 
>>to 0 :)
>>Test it ;)
> This is amoung the more trivial Computer Science problems out there. Yes,
> different languages may make it slightly easier or harder, but it is
> still trivial. If you think handling this poses even the slightest
> difficulty, then go away and don't come back until you know something.
> Then again the little bit of code you sent to the list was either Delphi
> or Modula 2/3/n (first thought was Pascal, but could of been Delphi). So
> I don't see much future in your work here anyway.
> Now my support for shooting anyone who made a client that emitted
> bencoded of the form 00+: had nothing to do with the difficulty of the
> problem. It had to do that making strings like that was a bad idea,
> though it shouldn't cause problems with any well written client.

Are you sure?
If you read a .torrent with 04:spam and then write it as 4:spam, the 
.torrent changed and the info_hash changed too. So IMO 04:spam would 
cause a problem.

------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.

Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    BitTorrent-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the BitTorrent mailing list