I have two strings that are hashed into a ulong (using Google’s CityHash) during separate processing stages and now must combine the two hashes into a new hash without significantly increasing the risk of a hash collision.
I know that XOR has some issues (such as Value ^ 0 = Value), but given that the two input values should already be well distributed, I suspect that I can combine the hashes like
ulong hash = hash1 ^ hash2; // hash1 and hash2 are ulong hashes of strings
Is there something wrong in this approach, or is there a better approach that does not add significant computational overhead?
Based on @GregS’s comments and my own further reading, I believe I’m not seriously degrading the hash distribution by using a simple XOR.
That is the approach that seems wisest.