This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients eric.smith, jdemeyer, mark.dickinson, rhettinger, sir-sigurd, tim.peters
Date 2018-10-02.19:15:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> So my suggestion remains
> for y in INPUT:
>    t = hash(y)
>    h ^= t
>    h *= MULTIPLIER

On the face of it, I'd be amazed if that passed SMHasher, because it only propagates bits "to the left".  All hashes that score well on that test work to propagate "to the right" too.  SeaHash does that with its variable-count right-shift-xor.  Another popular choice in other hashes is a rotate.

As noted several times before, our tuple tests only use small integers, where there's virtually no variation in the high-order hash bits beyond "all 0" or "all 1".  Since all the variation is in a handful of low-order bits, "propagate right" _appears_ to be a waste of time.

If we, e.g., tested tuples of little floats instead, we may have "concluded" that it's "propagate left" that's a waste of time:

>>> for i in range(5):
...     x = 1 / 2**i
...     print(x, hex(hash(x)
1.0                   0x1
0.5    0x1000000000000000
0.25    0x800000000000000
0.125   0x400000000000000
0.0625  0x200000000000000
Date User Action Args
2018-10-02 19:15:02tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, eric.smith, jdemeyer, sir-sigurd
2018-10-02 19:15:02tim.peterssetmessageid: <>
2018-10-02 19:15:02tim.peterslinkissue34751 messages
2018-10-02 19:15:01tim.peterscreate