MD5加密方法32位小写

        /// 
        /// MD5加密(32位小写)
        /// 
        /// 加密字符
        /// 
        public static string to_MD5(string str)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] fromData = System.Text.Encoding.UTF8.GetBytes(str);
            byte[] targetData = md5.ComputeHash(fromData);
            string byte2String = null;
            for (int i = 0; i < targetData.Length; i++)
            {
                byte2String = byte2String + targetData[i].ToString("x2");
            }

            return byte2String;
        }

Base64加密方式:

 1         /// 
 2         /// Base64
 3         /// 
 4         /// 
 5         /// 
 6         public string EncryptBase64(string source)
 7         {
 8             byte[] bytes = Encoding.UTF8.GetBytes(source);
 9             return Convert.ToBase64String(bytes);
10         }

 

你可能感兴趣的:(MD5加密方法32位小写)