C# md5 hash值求取 添加 system.web的引用
来源:互联网 发布:php 环境 编辑:程序博客网 时间:2024/06/06 13:07
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;
namespace md5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected string MD5(string str)
{
string test = str;
System.Security.Cryptography.MD5CryptoServiceProvider md5CSP = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] testEncrypt = System.Text.Encoding.Unicode.GetBytes(test);
byte[] resultEncrypt = md5CSP.ComputeHash(testEncrypt);
string testResult = System.Text.Encoding.Unicode.GetString(resultEncrypt);
return pwd.ToLower().Substring(8,16);
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = MD5(textBox1.Text);
}
}
}
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;
namespace md5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected string MD5(string str)
{
string test = str;
System.Security.Cryptography.MD5CryptoServiceProvider md5CSP = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] testEncrypt = System.Text.Encoding.Unicode.GetBytes(test);
byte[] resultEncrypt = md5CSP.ComputeHash(testEncrypt);
string testResult = System.Text.Encoding.Unicode.GetString(resultEncrypt);
//这个要在工程里面添加 system.web的引用
string pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(test, "MD5");return pwd.ToLower().Substring(8,16);
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = MD5(textBox1.Text);
}
}
}
0 0
- C# md5 hash值求取 添加 system.web的引用
- VS2010 C#控制台程序不能添加对System.Web的引用
- VS2010 C#控制台程序不能添加对System.Web的引用
- C# MD5 HASH的加密
- 一直“正在添加对system.web.dll的引用”
- system.web的引用问题
- c# windows应用程序不能添加web引用的问题
- 在C#的类库中添加web service引用
- 转载 C#的类库中添加Web Service引用
- 如何在C#的类库中添加web service引用
- 在C#的类库中添加web service引用
- 在C#项目中不显示Web引用的情况下如何添加“Web引用”?
- C#添加Web引用时提示超时
- VS 2010 winform程序添加对System.Web.Script.Serialization的引用
- 在类库中添加引用System.Web.SessionState 命名空间中遇到的问题(已解决)
- VS 2010 程序添加对System.Web.Script.Serialization的引用
- 添加web引用 的方法
- C# 中使用 MD5 算法计算 hash (哈希)值的四种方法
- .tar.bz2文件解压命令
- C++抽象机制 :对象,析构函数,默认构造函数
- 各类排序算法时间复杂度和空间度对比
- 关注个人开发者微信公众账号vjiazhi,改变观点,改变命运!
- Java的Integer类型使用==与equals
- C# md5 hash值求取 添加 system.web的引用
- SQL 视图
- ssi 开发oa邮件模块,怎么能将exchange 2010融合到一起?
- SQL语句删除和添加外键、主键
- String比较排序
- Json_encode过的字段值在mysql中模糊查询不出来的原因及解决办法
- PHP的启动与终止
- C#简单介绍 + helloworld
- 想通过点击不同按钮实现不同jpanel类的调用,该如何实现?