public static string SHA1(string input, Encoding encode)
{
try
{
using (SHA1 sha1 = new SHA1CryptoServiceProvider())
{
byte[] b_in = encode.GetBytes(input);
byte[] b_out = sha1.ComputeHash(b_in);
return BitConverter.ToString(b_out).Replace("-", "");
}
}
catch (Exception ex)
{
return string.Format("因{0},SHA1加密出错", ex.Message);
}
}