
4 Dec
2024
4 Dec
'24
1:16 p.m.
On Tue, Dec 3, 2024 at 9:09 PM Peter Dimov via Boost
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 [1]: https://www.sqlite.org/datatype3.html