快速的字符串散列算法,低碰撞率与32位整数整数、字符串、算法、快速

2023-09-10 22:35:31 作者:一又二分之一的夏天

我有很多我想做快速搜索对不相关的命名的东西。一个土豚始终是一个土豚无处不在,因此散列字符串和重用整数将工作做好,加快比较。整个组名称为未知(以及随时间变化)。这是一个快速字符串散列算法,将产生小的(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变种宜