1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Security.Cryptography; 6 7 namespace PCK 8 { 9 class Code 10 { 11 /// <summary> 12 /// MD532位加密 13 /// </summary> 14 /// <param name="encodeType">加密采用的编码方式</param> 15 /// <param name="source">待加密的明文</param> 16 /// <returns></returns> 17 public static string MD532Encode(Encoding encodeType,string source) 18 { 19 string encode = string.Empty; 20 byte[] bytes = encodeType.GetBytes(source); 21 MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); 22 try 23 { 24 encode = BitConverter.ToString(md5.ComputeHash(bytes)).Replace("-",""); 25 } 26 catch 27 { 28 encode = source; 29 } 30 return encode; 31 } 32 } 33 }