Combine HASHes with TREEs
Combine HASHes with TREEs
Posted Jan 12, 2012 23:41 UTC (Thu) by ppisa (subscriber, #67307)Parent article: Denial of service via hash collisions
The tuning of hash table size then tunes between O(1) but big amount of abundant memory filled by unused NULLs and O(logN) for total collision case.
If and default ul_hashtab_sizestep_default_table is used, the implementation tries to tune table and rehash data when the hash table size is too small or big for given item count.
Use example/test code is in ul_hashtabchk.c file.
Solution is not perfect but should prevent DoS quite well. The reason behind my decision for this structure was our real-time/control systems/application orientation where worst case scenarios/limits/considerations are the mantra.
The code is part of uLUt uLan libraries available under GPL, LGPL and MPL.