110,568
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Web.Security;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
byte[] result = Encoding.Default.GetBytes(textBox1.Text.Trim());
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
//textBox2.Text = BitConverter.ToString(output);//.Replace("-", "");
textBox2.Text = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(result.ToString(), "MD5").ToLower();
}
}
}
byte[] result = Encoding.Default.GetBytes(textBox1.Text.Trim());
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
textBox2.Text = BitConverter.ToString(output).Replace("-", "").ToLower();
string str = BitConverter.ToString(output);
textBox2.Text = str.Replace("-", "").ToLower().Substring(0, 32);