Author tim.peters
Recipients eric.smith, jdemeyer, mark.dickinson, rhettinger, sir-sigurd, tim.peters
Date 2018-10-02.21:41:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538516499.17.0.545547206417.issue34751@psf.upfronthosting.co.za>
In-reply-to
Content
> >>> from itertools import product
> >>> len(set(map(hash, product([0.5, 0.25], repeat=20))))
> 32

> Good catch! Would you like me to add this to the testsuite?

It's in mine already ;-)  I've added all the "bad examples" in all the messages here.  Sooner or later they'll get folded into Python's test suite.

BTW, there were no collisions in that under whatever 64-bit Python I last compiled.  That was a SeaHash variant.  I'm not certain, but I believe it had "t ^= t << 1" at the start and with the first multiply commented out.

Having learning _something_ about why SeaHash does what it does, I'm not convinced the first multiply is of much value.  As a standalone bit-scrambler for a single 64-bit input, it does matter.  But in the tuple hash context, we're running it in a loop.  Strictly alternating "propagate left" and "propagate right" seems to me almost as good - although that's just intuition.
History
Date User Action Args
2018-10-02 21:41:39tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, eric.smith, jdemeyer, sir-sigurd
2018-10-02 21:41:39tim.peterssetmessageid: <1538516499.17.0.545547206417.issue34751@psf.upfronthosting.co.za>
2018-10-02 21:41:39tim.peterslinkissue34751 messages
2018-10-02 21:41:39tim.peterscreate