[issue13703] Hash collision security issue

Marc-Andre Lemburg report at bugs.python.org
Fri Jan 6 13:56:49 CET 2012


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Stupid email interface again... here's the full text:

The hash-attack.patch solves the problem for the integer case
I posted earlier on and doesn't cause any problems with the
test suite.

>>> d = dict((x*(2**64 - 1), hash(x*(2**64 - 1))) for x in xrange(1, 100))
>>> d = dict((x*(2**64 - 1), hash(x*(2**64 - 1))) for x in xrange(1, 1000))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 'too many hash collisions'

It also doesn't change the hashing or dict repr in existing
applications.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13703>
_______________________________________


More information about the Python-bugs-list mailing list