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-09-28.04:43:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538109787.39.0.545547206417.issue34751@psf.upfronthosting.co.za>
In-reply-to
Content
Also worth noting:  other projects need to combine hashes too.  Here's a 64-bit version of the highly regarded C++ Boost[1] library's hash_combine() function (I replaced its 32-bit int literal with "a random" 64-bit one):

    x ^= (Py_uhash_t)y + 0x94ae1875aa5647f1UL + (x << 6) + (x >> 2);

It's very cheap.  It also sucks horribly if used as the guts Python's tuple hash loop ;-)

This isn't a paradox.  Best I can tell, Python may be unique in trying _not_ to make all hashes "look random".  If you have only randomish hashes to combine, the Boost approach works fine.
History
Date User Action Args
2018-09-28 04:43:07tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, eric.smith, jdemeyer, sir-sigurd
2018-09-28 04:43:07tim.peterssetmessageid: <1538109787.39.0.545547206417.issue34751@psf.upfronthosting.co.za>
2018-09-28 04:43:07tim.peterslinkissue34751 messages
2018-09-28 04:43:06tim.peterscreate