public static string ConsHash(string s) { var net = "\\\\sv-cifs01.tocci.com\\group"; string z = "z:"; string outs = ""; if (s.StartsWith("\\\\sv-cifs01.tocci.com\\group")) { outs = s.Replace(net, z); } else { outs = s; } string str = Convert.ToString(MurmurHash2.Hash(Encoding.ASCII.GetBytes(outs))); return("H-" + 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); }