Confused compare function :)

Chris Angelico rosuav at
Sun Dec 9 04:22:21 CET 2012

On Sun, Dec 9, 2012 at 2:07 PM, Ramchandra Apte <maniandram01 at> wrote:
> Not really. I remember a bug saying that only 256 hashes were required of known texts and then the randomization becomes useless.

That requires that someone be able to get you to hash some text and
give back the hash. In any case, even if you _are_ dealing with the
worst-case hash collision attack, all it does is stop a Python
dictionary from being an exception to the general principle. If you're
doing a lookup in, say, a tree, then checking if the element exists
and then retrieving it means walking the tree twice - O(log n) if the
tree's perfectly balanced, though a splay tree would be potentially
quite efficient at that particular case. But there's still extra cost
to the check.


More information about the Python-list mailing list