Time33哈希算法
算法:对字符串的每个字符,迭代的乘以33
公式: hash(i) = hash(i-1)*33 + str[i] ;
在使用时,存在一个问题,对相似的字符串生成的hashcode也类似,
可以对原始字符串,进行MD5,再hashcode。
uint32_t time33(char const *str, int len)
{
unsigned long hash = 0;
for (int i = 0; i < len; i++) {
hash = hash *33 + (unsigned long) str[i];
}
return hash;
}