2 ms·
That's assuming random distribution of hashes. I can trivially write a hash function that produces a unique 32-bit hash for inputs of 32-bit. Just truncate the
by TheCoelacanth 8y ago
That's assuming random distribution of hashes.
I can trivially write a hash function that produces a unique 32-bit hash for inputs of 32-bit. Just truncate the input to 32 bits. It's not a very good hash function for longer inputs, of course.
- iainmerrick 8y agoYou could do that and also use a real hash for longer inputs. Literally truncating the input wouldn’t be great in the likely case that your hash table is using only 10 bits (say) of the hash value, but I bet there are similar approaches that would work.
- FartyMcFarter 8y agoTrue - but I still don't think it's reasonable to assume that a hash function behaves that way.