mirror of https://github.com/python/cpython
Add a final permutation step to the tuple hash function.
Prevents a collision pattern that occurs with nested tuples. (Yitz Gale provided code that repeatably demonstrated the weakness.)
This commit is contained in:
parent
bce036b49e
commit
57c2d930f6
|
@ -190,6 +190,7 @@ Gyro Funch
|
||||||
Peter Funk
|
Peter Funk
|
||||||
Geoff Furnish
|
Geoff Furnish
|
||||||
Lele Gaifax
|
Lele Gaifax
|
||||||
|
Yitzchak Gale
|
||||||
Raymund Galvin
|
Raymund Galvin
|
||||||
Nitin Ganatra
|
Nitin Ganatra
|
||||||
Fred Gansevles
|
Fred Gansevles
|
||||||
|
|
|
@ -280,6 +280,7 @@ tuplehash(PyTupleObject *v)
|
||||||
x = (x ^ y) * mult;
|
x = (x ^ y) * mult;
|
||||||
mult += 82520L + len + len;
|
mult += 82520L + len + len;
|
||||||
}
|
}
|
||||||
|
x += 97531L;
|
||||||
if (x == -1)
|
if (x == -1)
|
||||||
x = -2;
|
x = -2;
|
||||||
return x;
|
return x;
|
||||||
|
|
Loading…
Reference in New Issue