[BitTorrent] Re: Bencoding: How to sort keys for dictionaries ?

skybuckflying skybuck2000 at hotmail.com
Sun Nov 21 21:08:45 EST 2004



--- In BitTorrent at yahoogroups.com, Brian Dessent <brian at d...> wrote:
> skybuckflying wrote:
> 
> > > It means they're sorted in lexicographical order.  This is a
> > frequently
> > > asked question so search the mailing list archives.
> > 
> > I did that turned up nothing ;)
> 
> The first time it came up was a thread "How to calculate info_hash?"
> from about 2003-May-17 on this list.  It has been asked several 
times
> here and on btports since.
> 
> > So I think a typical sorting algorithm (which uses compares) will
> > sort it just fine with a typical string compare function.
> 
> Yes, typical string sorting order.
> 
> > Well currently my implementation can store both the decoded and
> > encoded value.
> 
> This does not make any sense.  There is only one key value.  "foo" 
or
> "3:foo" both represents the same string.  Whether you choose to 
store
> the key as a C-style string, a length-delimited string, or your
> language's native string/scalar type makes no difference.  And that
> choice has nothing to do with the bencoding standard as there is no 
such
> thing as a "decoded" string in a bencoded file, by definition.

Oh I see you miss understand me.

When I wrote "store" I ment store internally inside the computer's 
memory/program so that a programmer can work with the decoded strings 
or even the encoded strings in case he wants to "encoded" them 
further into a list or a dictionary.

Ofcourse as soon as the programmers wants to create a torrent file 
for example, it should all be bencoded :)

Bye,
  Skybuck.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/BitTorrent/

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

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the BitTorrent mailing list