/// <summary> /// 转为MurmurHash /// </summary> /// <param name="str">字符串</param> /// <returns></returns> public static uint ToMurmurHash(this string str) { return(MurmurHash2.Hash(Encoding.UTF8.GetBytes(str))); }
//default String.GetHashCode() can't well spread strings like "1", "2", "3" public static int BetterHash(String key) { uint hash = MurmurHash2.Hash(Encoding.ASCII.GetBytes(key)); return((int)hash); }