重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

小小MD5器

小小MD5器

在贵南等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站制作、成都网站建设 网站设计制作按需求定制制作,公司网站建设,企业网站建设,高端网站设计,成都全网营销,外贸营销网站建设,贵南网站建设费用合理。

namespace MD5Tool
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

}

private void textBox1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, false))
{
e.Effect = DragDropEffects.All;
String[] files = (String[])e.Data.GetData(DataFormats.FileDrop, false);//获取文件
if (files.Length > 0)
{
textBox1.Text = files[0];
using (FileStream fs = new FileStream(files[0], FileMode.Open))
{
byte[] buffer = new byte[fs.Length];
int count = fs.Read(buffer, 0, buffer.Length);
string s = Encoding.UTF8.GetString(buffer, 0, count);
byte[] bs = Encoding.GetEncoding("gb2312").GetBytes(s);
StringBuilder sb = new StringBuilder();
using (MD5 mm = MD5.Create())
{
byte[] result = mm.ComputeHash(bs);
for (int i = 0,len=result.Length; i < len; i++)
{
sb.Append(result[i].ToString("x2"));
}
}
md5Vlalue.Text = sb.ToString();
}
}

}
}

private void textBox1_TextChanged(object sender, EventArgs e)
{
StringBuilder sb = new StringBuilder();//用来将字节拼起来
if (radioButton2.Checked)
{
string md5Words = textBox1.Text.Trim();//字符串md5要加密的字符串
byte[] bs = Encoding.GetEncoding("gb2312").GetBytes(md5Words);

using (MD5 md5 = MD5.Create())
{
byte[] bsw = md5.ComputeHash(bs);
for (int i = 0; i < bsw.Length; i++)
{
sb.Append(bsw[i].ToString("x2"));
}
}
}
md5Vlalue.Text = sb.ToString();
}

private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
textBox1.ReadOnly = true;
}
}
}


分享文章:小小MD5器
标题网址:http://cqcxhl.cn/article/ghssij.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP