murmurhash2和djb
日期: 2012-12-21 分类: 跨站数据测试 313次阅读
两个hash算法
1、djb算法
/* 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;
}
以上代码取自http://blog.csdn.net/chaosinux 除特别声明,本站所有文章均为原创,如需转载请以超级链接形式注明出处:SmartCat's Blog
上一篇: TI Cortex-A8 AM335X开发板工控板
下一篇: 将shell脚本用到实处
精华推荐