|
- public static string GetMd5_16(string Source)
- {
- MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
- string Dest = BitConverter.ToString(md5.ComputeHash(UTF8Encoding.Default.GetBytes(Source)), 4, 8);
- Dest = Dest.Replace("-", "");
- return Dest;
- }
- public static string GetMd5_32(string Source)
- {
- string Dest = "";
- MD5 md5 = MD5.Create();
- byte[] SourceByte = md5.ComputeHash(Encoding.UTF8.GetBytes(Source));
- for (int i = 0; i < SourceByte.Length; i++)
- {
- Dest = Dest + SourceByte[i].ToString("X2");
- }
- return Dest;
- }
复制代码 |
|