Commit 57c2d930 authored by Raymond Hettinger's avatar Raymond Hettinger

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.)
parent bce036b4
......@@ -190,6 +190,7 @@ Gyro Funch
Peter Funk
Geoff Furnish
Lele Gaifax
Yitzchak Gale
Raymund Galvin
Nitin Ganatra
Fred Gansevles
......
......@@ -280,6 +280,7 @@ tuplehash(PyTupleObject *v)
x = (x ^ y) * mult;
mult += 82520L + len + len;
}
x += 97531L;
if (x == -1)
x = -2;
return x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment