源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Winform中进行MD5加密的实例

  • 时间:2022-10-22 07:56 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:Winform中进行MD5加密的实例
[b]Winform,c#进行MD5加密直接上步骤:[/b] [b]1. 添加引用[/b] [b]2. 在.NET选项卡中找到“System.Web”[/b] [b]3. 选中之后,点击“确定”即可,此时会在解决方案中看到刚才添加的引用[/b] [b]4. 引用名空间:using System.Web.Security;[/b] Click事件中的代码如下: [img]http://files.jb51.net/file_images/article/201701/201701240951056.png[/img] [b]还有一种方法:[/b] 引用 using System.Security.Cryptography; using System.Text; 具体代码如下(写在按钮的Click事件里):
byte[] result = Encoding.Default.GetBytes(this.tbPass.Text.Trim());  //tbPass为输入密码的文本框
MD5 md5 = new MD5CryptoServiceProvider();
byte[] output = md5.ComputeHash(result);
this.tbMd5pass.Text = BitConverter.ToString(output).Replace("-",""); //tbMd5pass为输出加密文本的文本框

以上这篇Winform中进行MD5加密的实例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部