inpsymt.c, use "Daniel J. Bernstein" hash function
instead of a simple sum. just for note, there is a wealth of newer hash functions. For example "The FNV Non-Cryptographic Hash Algorithm" from http://tools.ietf.org/html/draft-eastlake-fnv-03
This commit is contained in:
parent
2eb5a7ac00
commit
97d99067a6
|
|
@ -273,10 +273,11 @@ void INPtabEnd(INPtables * tab)
|
||||||
|
|
||||||
static int hash(char *name, int tsize)
|
static int hash(char *name, int tsize)
|
||||||
{
|
{
|
||||||
char *s;
|
unsigned int hash = 5381;
|
||||||
register int i = 0;
|
char c;
|
||||||
|
|
||||||
for (s = name; *s; s++)
|
while ((c = *name++) != '\0')
|
||||||
i += *s;
|
hash = (hash * 33) ^ (unsigned) c;
|
||||||
return (i % tsize);
|
|
||||||
|
return (int) (hash % (unsigned) tsize);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue