乐趣区

关于c#:C-计算字符串-SHA1

private string SHA1(string str)
{byte[] strRes = Encoding.Default.GetBytes(str);
    HashAlgorithm iSha = new SHA1CryptoServiceProvider();
    strRes = iSha.ComputeHash(strRes);
    StringBuilder enText = new StringBuilder();
    foreach (byte iByte in strRes)
    {enText.AppendFormat("{0:x2}", iByte);
    }
    return enText.ToString();}
退出移动版