Skip to content

Guidance on hash collisions between different key types #89

Answered by tkaitchuck
reinerp asked this question in Q&A
Discussion options

You must be logged in to vote

As the layout affects hashing which of 1,2, or 3 is fed in will affect the resulting hash. This means that one cannot assume the same string with different amounts of padding or stored in one of these formats will hash differently. In general collisions would only occur between hashes of different layouts when the data from one matches the other. For example (u64, u64) would collide with (u32, u32) with the same numeric values, because when hashing u32s are just treated as u64s. But as you mention above (u64, u64) would very likely not collide with (u64, u64, u128) because those involve a different sequence of calls.

In terms of a faster result hashing a single u128 is faster than (u64, u…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tkaitchuck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants