|
Boost : |
From: Dominique Devienne (ddevienne_at_[hidden])
Date: 2024-12-04 13:16:04
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
[1]: https://www.sqlite.org/datatype3.html
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk