eina: disable randomisation for Eina_Hash superfast.

SVN revision: 83698
This commit is contained in:
Cedric BAIL 2013-02-07 03:07:32 +00:00
parent 1cb8c3c006
commit d9cafa2052
2 changed files with 7 additions and 3 deletions

View File

@ -1325,7 +1325,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;

View File

@ -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);