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 <1538507702.09.0.545547206417.issue34751@psf.upfronthosting.co.za>
In-reply-to
Content
> So my suggestion remains
>
> for y in INPUT:
>    t = hash(y)
>    t ^= t * SOME_LARGE_EVEN_NUMBER
>    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
History
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: <1538507702.09.0.545547206417.issue34751@psf.upfronthosting.co.za>
2018-10-02 19:15:02tim.peterslinkissue34751 messages
2018-10-02 19:15:01tim.peterscreate