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
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue