|
Boost : |
From: Jeff Flinn (jeffrey.flinn_at_[hidden])
Date: 2024-12-23 03:52:46
On 12/4/24 5:15 AM, Peter Dimov via Boost wrote:
> Alexander Grund 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" )
>> I can imagine an argument that the "collision" is intentional here, i.e.
>> that the `data` really is just "foobarfoobarfoobar"
>
> I'm sure you can, but there are actual rules governing the behavior
> of hash functions that don't depend on people imagining things.
>
> Equal arguments must produce the same hash value, and unequal
> arguments should produce different hash values.
>
> Since the arguments above are distinct (with respect to operator==),
> they should produce distinct hash values.
Both astute and absolutely correct. Thank you Peter.
>
>
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk