zoukankan      html  css  js  c++  java
  • win form MD5加密两种方法

    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

  • 相关阅读:
    Jenkins中Jelly邮件模板的配置
    十天冲刺(10)
    代码大全阅读笔记01
    大二下学期学习进度(十)
    十天冲刺(9)
    十天冲刺(8)
    统计文章中字母、单词出现的频率
    十天冲刺(7)
    十天冲刺(6)
    十天冲刺(5)
  • 原文地址:https://www.cnblogs.com/hantianwei/p/1639812.html
Copyright © 2011-2022 走看看