L
Lars Tackmann
Hi i need a hash function for some large strings (upto 1024 chars in the
array) the following is not very good for these large strings:
int string_hash(int hash_size, const char *key)
{
unsigned long n = 0;
const char *p;
for (p = key; *p != '\0'; p++)
n = ((n << 8) + n) ^ (unsigned long)(*p);
printf("n er: %i", n);
return (n % hash_size);
}
Any ideas -
array) the following is not very good for these large strings:
int string_hash(int hash_size, const char *key)
{
unsigned long n = 0;
const char *p;
for (p = key; *p != '\0'; p++)
n = ((n << 8) + n) ^ (unsigned long)(*p);
printf("n er: %i", n);
return (n % hash_size);
}
Any ideas -