Boost logo

Boost :

Subject: Re: [boost] [interprocess] boost::hash - different values for the same input?
From: Daniel James (dnljms_at_[hidden])
Date: 2016-01-13 18:16:07


On 13 January 2016 at 22:30, Bjorn Reese <breese_at_[hidden]> wrote:
> On 01/13/2016 11:18 PM, Andrey Semashev wrote:
>
>> Do you think we could add a few well-known hash functions to Boost.Hash
>> so that they could be used for consistent results?
>
>
> I was just about to suggest the same...
>
> I frequently use hash functions to calculate fingerprints that are
> exchanged in network protocols, and here consistent results, both
> across platforms and boost releases, are essential.

I think I've always been clear that the library is not appropriate for
such uses. In terms of hash quality, it does nothing more than meet
the existing std::hash requirements (which are very low). It's also
pretty much impossible to fit a stronger hash function into the
existing interface. I actually regret calling it 'hash', I probably
should have called it something less general. Technically its name is
'Functional/Hash', because std::hash is in the functional header, but
that didn't make much sense to anyone.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk