首页 > 代码库 > Sha1加密

Sha1加密

  1.         /// <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();        }