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:09:57


On 13 January 2016 at 22:18, Andrey Semashev <andrey.semashev_at_[hidden]> 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 think that would be best handled in a new library. I don't really
want to enhance the existing one beyond its current scope, especially
as the current standard proposal is a bit different to it, and
supports alternative hash functions. Adding extra functions would
probably also mean that it wouldn't be a header only library, which
would be a problem.

If you haven't seen the new proposal, it's at:

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0029r0.html

There's an implementation at:

https://github.com/google/hashing-demo/tree/N0029R0

I assume that something based on that proposal is likely to be
accepted. You could just use it (maybe I should add a macro to change
the default hash function in unordered....), or perhaps a boost
implementation could be based on it. One advantage of a new library is
that it can have much stricter compiler requirements which should
simplify the implementation.


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