Branch: Tag:

2011-12-30

2011-12-30 12:30:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

String handling: Added low_hashmem() for keyed hashing.

The string table now uses keyed hashing.
Also added a heuristic for changing the hashkey if the hashtable is unbalanced.
This should alleviate the impact of the #hashdos attack to a minimum.

153: Inside #if (defined(__i386__) || defined(__amd64__)) && defined(__GNUC__) and #if defined(__i386__)
  #ifdef __i386__   __attribute__((fastcall))   #endif - size_t (*hashmem)(const void *, size_t, size_t); +  size_t (*low_hashmem)(const void *, size_t, size_t, size_t);   #else - PMOD_EXPORT size_t hashmem(const void *, size_t len, size_t mlen) ATTRIBUTE((pure)); + PMOD_EXPORT size_t low_hashmem(const void *, size_t len, size_t mlen, size_t key) ATTRIBUTE((pure));   #endif -  + PMOD_EXPORT size_t hashmem(const void *, size_t len, size_t mlen) ATTRIBUTE((pure));   /*   PMOD_EXPORT void memfill(char *to,    INT32 tolen,