in reply to how are the number of buckets in a perl hash chosen
Choosing a good hash function is a bit of a black magic. Modulo prime might yield a better bucket distribution in simple cases with simple hash functions, e.g. when the keys fall into regular label+number pattern.
In practice, the modulo operation (by a variable) is often insufferably slow compared to arithmetic shift or masking. Therefore, power-of-two bucket sizes are preferred, together with a robust hash function. Strong (and randomized) hash function is a necessity nowadays. Does the course mention security aspects of generic hash implementations, such as resistance to DoS attacks?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how are the number of buckets in a perl hash chosen
by david2008 (Scribe) on Jun 09, 2014 at 09:00 UTC |