using System;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Web.Security;
using System.Web;

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("-","");
        }
    }
}

posted on 2016-06-01 20:31  波波嘟  阅读(290)  评论(0编辑  收藏  举报