Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-10 17:42:22


Andrey Semashev wrote:
> Currently, as I look in the hash algorithms provided by Boost.Hash2, most of
> them interpret the byte-range seed the way you describe, with the exception
> of fnv1a and siphash. fnv1a doesn't append the seed size (and doesn't pad as
> FNV-1a is not a block hash); I'm not sure if that's intentional.

I suppose it would be better for it to do so, yes.

> siphash has special treatment of the seed if it is exactly 8 bytes.

That's because this specific handling of the key is part of its specification, as
siphash is a keyed hash function. So if you use siphash as specified, using the
key length that it mandates, you get its documented (in siphash.pdf) behavior
and it passes the corresponding siphash test suite.

> Given these differences, is the user able to have any sort of guarantee
> on consistent behavior of the constructors of various algorithms? If not, why
> provide the constructor at all?

The constructor does what it's specified to do in the hash algorithm
requirements. Yes, the user can rely on that.


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