[issue34751] Hash collisions for tuples
Tim Peters
report at bugs.python.org
Mon Sep 24 20:42:29 EDT 2018
Tim Peters <tim at python.org> added the comment:
Just noting that this Bernstein-like variant appears to work as well as the FNV-1a version in all the goofy ;-) endcase tests I've accumulated:
while (--len >= 0) {
y = PyObject_Hash(*p++);
if (y == -1)
return -1;
Py_uhash_t t = (Py_uhash_t)y;
t ^= t << 7;
x = x * mult + t;
}
They're identical except for the last line. FNV-1a uses
x = (x ^ t) * mult;
instead.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34751>
_______________________________________
More information about the Python-bugs-list
mailing list