c# 的Hash码实现源码

 public int GetHashCode(string s)

    {

        int hash = 5381;

        int len = s.Length;



        for (int i = 0; i < len; i++)

        {

            int c = Convert.ToInt32(s[i]);

            hash = ((hash << 5) + hash) ^ c;

        }



        return hash;

    }

 

你可能感兴趣的:(hash)