Re: Re: Bencoding: How to sort keys for dictionaries ?
Brian Dessent <[email protected]>
| Newsgroups | gmane.network.bit-torrent.general |
|---|---|
| Organization | My own little world... |
| Message-ID | <[email protected]> |
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.
Brian
------------------------ 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:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/