DJB hash function for strings
日期: 2012-08-10 分类: 跨站数据测试 337次阅读
/* the famous DJB Hash Function for strings */
unsigned int DJBHash(char *str)
{
unsigned int hash = 5381;
while (*str){
hash = ((hash << 5) + hash) + (*str++); /* times 33 */
}
hash &= ~(1 << 31); /* strip the highest bit */
return hash;
}
for more information: String hash functions compare
除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog
精华推荐