C# Hash字符串
public static byte[] GetHash(string inputString)
{
HashAlgorithm algorithm = MD5.Create(); //or use SHA256.Create();
return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString));
}
public static string GetHashString(string inputString)
{
StringBuilder sb = new StringBuilder();
foreach (byte b in GetHash(inputString))
sb.Append(b.ToString("X2"));
return sb.ToString();
}
来源:StackOverflow