Boost logo

Boost :

Subject: Re: [boost] [hash] Extract module from functional + std::hash_combine
From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2018-01-06 17:59:37


On Sat, Jan 6, 2018 at 9:54 AM, Bjorn Reese via Boost
<boost_at_[hidden]> wrote:
> I mean being able to sets its parameters, like offset and modulo. While
> this is not the usual way of handling the situation, it is pragmatic
> alternative to than having to deal with tabulation and universal
> hashing. That said, I would be happy with any solution of obtaining a
> family of related hash functions.

I am not familiar with the terms offset and modulo as applied to
popular non-cryptographic hash algorithms such as xxHash or
SpookyHash. Perhaps you are thinking of a linear congruential
generator? Usually the constants chosen for the hash functions are
picked for their numeric properties and cannot be changed.

Some of these algorithms allow the user to provide an integral "seed"
which is used to permute the result. This can be used to protect a
container from algorithmic complexity attacks when used with possibly
adversarial inputs. In the absence of an algorithm which allows for a
seed, a less efficient but equally effective method is to prepend a
unique value, specific to the instance of the hash function, to the
input data. This can be turned into a generic wrapper (I believe Peter
will eventually add such a thing if he has not done so already).

The standard approach to supplying such parameters to the hash
function is to provide the values upon construction in the argument
list.

Thanks


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