2 ms·
Backing arrays for fast hash tables are always powers of 2. That's how they are implemented in all mainstream languages. Details are often omitted in academia b
by bjourne 7y ago
Backing arrays for fast hash tables are always powers of 2. That's how they are implemented in all mainstream languages. Details are often omitted in academia because of publishing constraints or because the authors thought they were obvious.
- rurban 7y agoFast yes, but more insecure. Using prime sized tables will get all hash bits being used. With power of 2 you can get away with the mod, but it's easier to crack, and the grow factor is bigger than the ideal fibonacci sequence, or a prime sequence.
- bjourne 7y agoAs long as you have a decent hash function that distributes the bits properly it doesn't matter. IME, it makes no difference performance wise if you the golden ratio (1.61...) as the growth factor or 2.