标签:public 字符 name convert odi com summary md5 class
/// <summary> /// MD5加密(32位小写) /// </summary> /// <param name="str">加密字符</param> /// <returns></returns> 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 /// <summary> 2 /// Base64 3 /// </summary> 4 /// <param name="source"></param> 5 /// <returns></returns> 6 public string EncryptBase64(string source) 7 { 8 byte[] bytes = Encoding.UTF8.GetBytes(source); 9 return Convert.ToBase64String(bytes); 10 }
标签:public 字符 name convert odi com summary md5 class
原文地址:https://www.cnblogs.com/evansblog/p/13358991.html