快速的字符串散列算法,低碰撞率与32位整数 [英] Fast String Hashing Algorithm with low collision rates with 32 bit integer

查看:214
本文介绍了快速的字符串散列算法,低碰撞率与32位整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多我想做快速搜索对不相关的命名的东西。一个土豚始终是一个土豚无处不在,因此散列字符串和重用整数将工作做好,加快比较。整个组名称为未知(以及随时间变化)。这是一个快速字符串散列算法,将产生小的(32或16)的比特值,并有一个低碰撞率α

I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is unknown (and changes over time). What is a fast string hashing algorithm that will generate small (32 or 16) bit values and have a low collision rate?

我想看到具体到C / C ++优化的实现。

I'd like to see an optimized implementation specific to C/C++.

推荐答案

一href="http://isthe.com/chongo/tech/comp/fnv/"> FNV变种宜

One of the FNV variants should meet your requirements. They're fast, and produce fairly evenly distributed outputs.

这篇关于快速的字符串散列算法,低碰撞率与32位整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆