I am using DJB2 hash function in my hashing program where I want to store strings. But this hash function returns a very large unsigned int value as return value(hash table index). If my table size is very small (say 13), is there any way to convert this large value into smaller one. All I want to avoid collision as much as possible.
The DJB2 hash function code is as follows:
unsigned int djb_hash(string s)
{
int i;
unsigned int h;
h = 5381;
for (i = 0; i < s.size(); i++)
{
h = (h << 5) + h + s[i];
}
return h;
}