GHash: add note about randomness in hashing
authorRyan Lortie <desrt@desrt.ca>
Wed, 25 Jan 2012 15:09:09 +0000 (10:09 -0500)
committerRyan Lortie <desrt@desrt.ca>
Wed, 25 Jan 2012 15:09:09 +0000 (10:09 -0500)
To clarify our statements about being robust against outside attackers
degrading the performance of your hashtable.

glib/ghash.c

index 92c16c9..b058d17 100644 (file)
  * Using g_str_hash() in that situation might make your application
  * vulerable to <ulink url="https://lwn.net/Articles/474912/">Algorithmic Complexity Attacks</ulink>.
  *
+ * The key to choosing a good hash is unpredictability.  Even
+ * cryptographic hashes are very easy to find collisions for when the
+ * remainder is taken modulo a somewhat predictable prime number.  There
+ * must be an element of randomness that an attacker is unable to guess.
+ *
  * Returns: the hash value corresponding to the key
  */