using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Cryptography;
namespace NENUBookManageSystem
{
class UserPasswordMD5
{
public static string Encrypt(string password)
{
MD5 md5 = new MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.Default.GetBytes(password);
byte[] md5data = md5.ComputeHash(data);
md5.Clear();
string str = “”;
for (int i = 0; i < md5data.Length – 1;++i )
{
str += md5data[i].ToString(“x”).PadLeft(2, ‘0’);
}
return str;
}
}
}