hash算法
CityHash算法的开发是受到了 MurmurHash的启发
为了满足大数量的需求,减少碰撞,我们一般需要给出一个32位,64位或者128位的哈希,Google发布了一个叫做CityHash的方法,
能比较快的生成一个32位,64位或者128位的字符串签名,效率在64位cpu上得到了特殊优化,在工业级应用中可以使用该哈希算法,代码公布在google code上。
总体而言,CityHash64 与 CityHash128 是解决经典问题的全新算法
https://github.com/google/cityhash
murmurhash
属于非加密型hash算法
MurmurHash算法:高运算性能,低碰撞率,由Austin Appleby创建于2008年,现已应用到Hadoop、libstdc++、nginx、libmemcached等开源系统。
2011年Appleby被Google雇佣,随后Google推出其变种的CityHash算法。
Murmur is a family of good general purpose hashing functions, suitable for non-cryptographic usage. As stated by Austin Appleby, MurmurHash provides the following benefits:
simple (in term of number of generated assembly instructions).
good distribution (passing chi-squared tests for practically all keysets & bucket sizes.
good avalanche behavior (max bias of 0.5%).
good collision resistance (passes Bob Jenkin’s frog.c torture-test. No collisions possible for 4-byte keys, no small (1- to 7-bit) differentials).
great performance on Intel/AMD hardware, good tradeoff between hash quality and CPU consumption.