生成跟php一致的sha1字符串
public static string GetHash(string str) { SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider(); byte[] str1 = Encoding.UTF8.GetBytes(str); byte[] str2 = sha1.ComputeHash(str1); sha1.Clear(); (sha1 as IDisposable).Dispose(); string ret = ""; foreach (byte a in str2) { if (a < 16) ret += "0" + a.ToString("x"); else ret += a.ToString("x"); } return ret; }