-
/// <summary> /// Sha1 /// </summary> /// <param name="str"></param> /// <returns></returns> public static string Sha1(string str) { byte[] strres = Encoding.Default.GetBytes(str); HashAlgorithm isha = new SHA1CryptoServiceProvider(); strres = isha.ComputeHash(strres); StringBuilder EnText = new StringBuilder(); foreach (byte item in strres) { EnText.AppendFormat("{0:x2}", item); } return EnText.ToString(); }
/// <summary> /// Sha1 /// </summary> /// <param name="str"></param> /// <returns></returns> public static string Sha1(string str) { byte[] strres = Encoding.Default.GetBytes(str); HashAlgorithm isha = new SHA1CryptoServiceProvider(); strres = isha.ComputeHash(strres); StringBuilder EnText = new StringBuilder(); foreach (byte item in strres) { EnText.AppendFormat("{0:x2}", item); } return EnText.ToString(); }
Sha1加密
时间: 2024-11-09 10:09:24