From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-12 15:50:54


Andrey Semashev wrote:
> On 12/12/24 16:22, Peter Dimov via Boost wrote:
> >
> > Using default-constructed instances of the hash algorithm, instead of
> > copies, makes the hashing seed-independent, which means that a way to
> > engineer collisions will work regardless of the seed used.
>
> But the original hash algorithm h does depend on the seed, and so does its
> final result.

void hash_append_unordered_range( Hash& h, Flavor const& f, It first, It last )

    std::uint64_t w = 0;

    // compute w from [first, last)

    hash2::hash_append( h, f, w );
    hash2::hash_append_size( h, f, m );

If two different ranges produce the same w, the final result will be the same,
even though it does depend on the seed.