MurmurHash算法

MurmurHash is a non-cryptographic hash function suitable for general hash-based lookup.The name comes from two basic operations, multiply (MU) and rotate (R), used in its inner loop. Unlike cryptographic hash functions, it is not specifically designed to be difficult to reverse by an adversary, making it unsuitable for cryptographic purposes.

MurmurHash 是一种非加密型哈希函数,适用于一般的哈希检索操作。已经被应用到很多开源项目如Redis,Memcached,Cassandra,HBase,Lucene等。与其它流行的哈希函数相比,对于规律性较强的key,MurmurHash的随机分布特征表现更良好。

优缺点

  • 速度快,比安全散列算法快几十倍;
  • 变化足够激烈,相似的字符串如“abc”和“abd”能够均匀散落在哈希环上;
  • 不保证安全性(缺点)