Add keyed hash functions (GHashMap)
From #1198 (comment 265420):
While I’m in favour of performance improvements to hashing which are applicable to a general set of use cases, I’m a bit hesitant about changing how
GHashTableworks at this point. The last time we changed the hashing algorithms (a number of years ago), there was a lot of fallout from applications and tests which had assumed a particular iteration order over a hash table. While that is definitely a bug in those applications, fixing it all was a massive pain. A change to Robin Hood hashing would necessarily change the iteration order again.
I wonder if, instead of changing
GHashTable, we should introduce a new
GHashMap(or similar) data type which implements Robin Hood hashing, but which also fixes bugs like #613, and uses keyed hash functions so we’re not vulnerable to attacks like this. (While we can tell people that
GHashTableis not secure against that kind of attack, people are realistically going to continue using it in bits of code which are network accessible.)