Re: [boost] Re: [review] hash functions

In-Reply-To: <d19tal$32u$1@sea.gmane.org> daniel@calamity.org.uk (Daniel James) wrote (abridged):
We can't tell if it was correct, because you didn't specify the equality function for the type.
Err, I wasn't asking you whether it was correct. I'm not asking for assistance with that old code; I found and fixed the problems long ago. I mentioned this stuff only because it is part of my background and experience, which the formal review guidelines say should be included in the review.
But the point is, if the types are right, then Peter's proposal is ideal in this situation.
As I said, the main problem was that my primitive hash_values often produced zero, and my combine function combined zeroes into zeroes. Combining a bool doesn't help when the bool itself hashes to zero. Another problem is that in some places I was using a version of hash_combine that wasn't order-dependant. The original boost proposal was better in that respect. Even fixing those issues, you really only get one additional bit of entropy by including the bool. You get slightly more entropy if you include the types as well. Sometimes every little helps. Especially if the hash_combine function isn't of cryptographic strength.
And it wasn't actually correct (with the current interface)
It wasn't using the current interface - it wasn't using boost at all. The actual function wasn't even called hash_value. I translated my functions into the proposed terminology rather than explain my terminology. -- Dave Harris, Nottingham, UK

Dave Harris wrote:
Err, I wasn't asking you whether it was correct. I'm not asking for assistance with that old code; I found and fixed the problems long ago.
I wasn't trying to fix your code. I was pointing out that for some equality functions, the hash function you gave is ideal. I think there was an example of this in my mail. Fixing your case would break it. Daniel
participants (2)
-
brangdon@cix.compulink.co.uk
-
Daniel James