数字签名算法(C#)

public static string GetSHA1Method(string strSource)
{
string strResult = "";

//Create
System.Security.Cryptography.SHA1 sha = System.Security.Cryptography.SHA1.Create();
byte[] bytResult = sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strSource));
for (int i = 0; i < bytResult.Length; i++)
{
strResult = strResult + bytResult[i].ToString("X2");
}
return strResult;
}

posted @ 2014-01-23 12:44  quietwalk  阅读(1893)  评论(0编辑  收藏  举报