[issue13703] Hash collision security issue
Charles-François Natali
report at bugs.python.org
Fri Jan 20 10:03:20 CET 2012
Charles-François Natali <neologix at free.fr> added the comment:
> A dict can contain non-orderable keys, I don't know how an AVL tree
> can fit into that.
They may be non-orderable, but since they are required to be hashable,
I guess one can build an comparison function with the following:
def cmp(x, y):
if x == y:
return 0
elif hash(x) <= hash(y):
return -1
else:
return 1
It doesn't yield a mathematical order because it lacks the
anti-symmetry property, but it should be enough for a binary search
tree.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13703>
_______________________________________
More information about the Python-bugs-list
mailing list