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

需要添加引用:System.Web

相关文章:

  • 2021-09-13
  • 2022-01-07
  • 2021-05-23
  • 2021-12-29
  • 2021-09-05
猜你喜欢
  • 2022-01-07
  • 2021-08-21
  • 2021-12-31
  • 2021-07-01
  • 2022-12-23
相关资源
相似解决方案