Author jdemeyer
Recipients eric.smith, jdemeyer, mark.dickinson, rhettinger, sir-sigurd, tim.peters
Date 2018-10-02.12:38:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1538483903.77.0.545547206417.issue34751@psf.upfronthosting.co.za>
In-reply-to
Content
SeaHash seems to be designed for 64 bits. I'm guessing that replacing the shifts by

x ^= ((x >> 16) >> (x >> 29))

would be what you'd do for a 32-bit hash. Alternatively, we could always compute the hash with 64 bits (using uint64_t) and then truncate at the end if needed.

However, when testing the hash function

    for t in INPUT:
        x ^= hash(t)
        x *= MULTIPLIER
        x ^= ((x >> 16) >> (x >> 29))
        x *= MULTIPLIER

It fails horribly on the original and my new testsuite. I'm guessing that the problem is that the line x ^= ((x >> 16) >> (x >> 29)) ignores low-order bits of x, so it's too close to pure FNV which is known to have problems. When replacing the first line of the loop above by x += hash(t) (DJB-style), it becomes too close to pure DJB and it also fails horribly because of nested tuples.

So it doesn't seem that the line x ^= ((x >> 16) >> (x >> 29)) (which is what makes SeaHash special) really helps much to solve the known problems with DJB or FNV.
History
Date User Action Args
2018-10-02 12:38:23jdemeyersetrecipients: + jdemeyer, tim.peters, rhettinger, mark.dickinson, eric.smith, sir-sigurd
2018-10-02 12:38:23jdemeyersetmessageid: <1538483903.77.0.545547206417.issue34751@psf.upfronthosting.co.za>
2018-10-02 12:38:23jdemeyerlinkissue34751 messages
2018-10-02 12:38:23jdemeyercreate