Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2024-12-04 13:34:14


Dominique Devienne wrote:
> On Tue, Dec 3, 2024 at 9:09 PM Peter Dimov via Boost
> <boost_at_[hidden]> wrote:
> > On the other hand, it makes it trivial to generate collisions
> >
> > pair<string, string>( "foo", "bar" )
> > pair<string, string>( "foob", "ar" )
> > pair<string, string>( "fooba", "r" )
>
> Independently of what others noted that this does not in fact collide, this
> reminds me a bit of https://www.sqlite.org/dbhash.html,
> which hashes an SQLite DB. DRH hashes each row/col value's type [1], in
> addition to the value's bytes, thus such collisions can't happen.
>
> Thus it would hash:
> { SQLITE_TEXT, "foo", SQLITE_TEXT, "bar" } { SQLITE_TEXT, "foob",
> SQLITE_TEXT, "ar" } { SQLITE_TEXT, "fooba", SQLITE_TEXT, "r" }
>
> resulting in different hashes. --DD

That's the equivalent of hashing a variant, which does (or should, anyway)
include the index.


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