Re:String.hashCode() is plenty unique
by iainmerrick on Saturday August 11, 2018 @03:29PM
(#17741144)
You 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.
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.