[glib/glib-2-30] GHash: add note about randomness in hashing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/glib-2-30] GHash: add note about randomness in hashing
- Date: Sun, 11 Mar 2012 22:23:04 +0000 (UTC)
commit f6a7a70a1fa628c2aaa9442003ab25697482ccb8
Author: Ryan Lortie <desrt desrt ca>
Date: Wed Jan 25 10:09:09 2012 -0500
GHash: add note about randomness in hashing
To clarify our statements about being robust against outside attackers
degrading the performance of your hashtable.
glib/ghash.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/glib/ghash.c b/glib/ghash.c
index 0ea372e..5eb093f 100644
--- a/glib/ghash.c
+++ b/glib/ghash.c
@@ -162,6 +162,11 @@
* 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
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]