Author tim.peters
Recipients eric.smith, jdemeyer, mark.dickinson, rhettinger, sir-sigurd, tim.peters
Date 2018-09-25.00:42:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1537836149.09.0.545547206417.issue34751@psf.upfronthosting.co.za>
In-reply-to
Content
Just noting that this Bernstein-like variant appears to work as well as the FNV-1a version in all the goofy ;-) endcase tests I've accumulated:

    while (--len >= 0) {
        y = PyObject_Hash(*p++);
        if (y == -1)
            return -1;
        Py_uhash_t t = (Py_uhash_t)y;
        t ^= t << 7;
        x = x * mult + t;
    }

They're identical except for the last line.  FNV-1a uses

         x = (x ^ t) * mult;

instead.
History
Date User Action Args
2018-09-25 00:42:29tim.peterssetrecipients: + tim.peters, rhettinger, mark.dickinson, eric.smith, jdemeyer, sir-sigurd
2018-09-25 00:42:29tim.peterssetmessageid: <1537836149.09.0.545547206417.issue34751@psf.upfronthosting.co.za>
2018-09-25 00:42:29tim.peterslinkissue34751 messages
2018-09-25 00:42:28tim.peterscreate