标签:static ati SHA256 encoding i++ from ret mst com
/// <summary>
/// SHA256加密
/// </summary>
/// <param name="strData"></param>
/// <returns></returns>
public static string GetSHA256HashFromString(string strData)
{
byte[] bytValue = System.Text.Encoding.UTF8.GetBytes(strData);
SHA256 sha256 = new SHA256CryptoServiceProvider();
byte[] retVal = sha256.ComputeHash(bytValue);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < retVal.Length; i++)
{
sb.Append(retVal[i].ToString("x2"));
}
return sb.ToString();
}
标签:static ati SHA256 encoding i++ from ret mst com
原文地址:http://www.cnblogs.com/LiHeQ/p/7194097.html