
Dominique Devienne wrote:
On Tue, Dec 3, 2024 at 9:09 PM Peter Dimov via Boost
wrote: On the other hand, it makes it trivial to generate collisions
pair
( "foo", "bar" ) pair ( "foob", "ar" ) pair ( "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.