summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/include/eina_hash.h8
-rw-r--r--src/lib/eina_hash.c2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/include/eina_hash.h b/src/include/eina_hash.h
index 2ba0851..d73a775 100644
--- a/src/include/eina_hash.h
+++ b/src/include/eina_hash.h
@@ -226,11 +226,12 @@
* @li @c string_small - slower hash function but less collisions - 32 buckets
* (lower memory consumption)
* @li @c string_superfast - slower hash function but less collisions - 256 buckets
- * (higher memory consumption)
+ * (higher memory consumption) - not randomized, avoid it on public remote interface.
*
* Basically for a very small number of keys (10 or less), @c djb2 should be
* used, or @c string_small if you have a restriction on memory usage. And for a
- * higher number of keys, @c string_superfast should be always preferred.
+ * higher number of keys, @c string_superfast should be preferred if not used on a
+ * public remote interface.
*
* If just stringshared keys are being added, use @ref
* eina_hash_stringshared_new. If a lot of keys will be added to the hash table
@@ -395,6 +396,9 @@ EAPI Eina_Hash *eina_hash_string_djb2_new(Eina_Free_Cb data_free_cb);
* then be looked up with pointers other than the original key pointer
* that was used to add values. On failure, this function returns
* @c NULL.
+ *
+ * NOTE: don't use this kind of hash when their is a possibility to remotely
+ * request and push data in it. This hash is subject to denial of service.
*/
EAPI Eina_Hash *eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb);
diff --git a/src/lib/eina_hash.c b/src/lib/eina_hash.c
index 37b7751..821d225 100644
--- a/src/lib/eina_hash.c
+++ b/src/lib/eina_hash.c
@@ -1328,7 +1328,7 @@ eina_hash_iterator_tuple_new(const Eina_Hash *hash)
EAPI int
eina_hash_superfast(const char *key, int len)
{
- int hash = len ^ eina_seed, tmp;
+ int hash = len, tmp;
int rem;
rem = len & 3;