DJBX33A (Daniel J. Bernstein, Times 33 with Addition) This is Daniel J. Bernstein's popular `times 33' hash function as posted by him years ago on comp.lang.c. It basically uses a function like ``hash(i) = hash(i-1) * 33 + str[i]''. This is one of the best known hash fun...
1 DJBX33A算法原理 DJBX33A (Daniel J. Bernstein, Times 33 with Addition)哈希算法速度非常快,并且分类非常好(冲突小,分布均匀),是比较理想的字符串哈希算法,目前被广泛应用在多个软件项目中,例如:PHP,Python,Apache,Nginx和BerkeleyDB等。DJBX33A算法简单实现: unsigned long djbx33a_hash(const char *str, size_t...
time33 哈希函数,又叫 DJBX33A,Bernstein's hash php, apache, perl, bsddb都使用time33哈希. 最简单的版本 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; } 这个...