MD5加密方法
时间:2011-04-11 来源:Jerry's Paradise
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace Test
{
public sealed class MD5Util
{
public static string Encryption(string input)
{
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] InBytes = Encoding.Default.GetBytes(input);
byte[] OutBytes = md5.ComputeHash(InBytes);
StringBuilder output = new StringBuilder();
for (int i = 0; i < OutBytes.Length; i++)
{
output.Append(OutBytes[i].ToString("x2"));
}
return output.ToString();
}
// Decryption
}
}