using
System;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Web.Security;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static string MD5( string password)
{
MD5CryptoServiceProvider md5;
md5 = new MD5CryptoServiceProvider();
return BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)));
}
private void button1_Click( object sender, EventArgs e)
{
string t1 = textBox1.Text;
string tm = FormsAuthentication.HashPasswordForStoringInConfigFile(t1, " MD5 " );
textBox2.Text = tm;
textBox3.Text = MD5(t1).Replace( " - " , "" );
}
}
}
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Web.Security;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static string MD5( string password)
{
MD5CryptoServiceProvider md5;
md5 = new MD5CryptoServiceProvider();
return BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(password)));
}
private void button1_Click( object sender, EventArgs e)
{
string t1 = textBox1.Text;
string tm = FormsAuthentication.HashPasswordForStoringInConfigFile(t1, " MD5 " );
textBox2.Text = tm;
textBox3.Text = MD5(t1).Replace( " - " , "" );
}
}
}
需要添加引用:System.Web