zoukankan      html  css  js  c++  java
  • MD5加密

    方法一:(32位)
    /// <summary>
    /// 重置密码
    /// </summary>
    /// <param name="pwd"></param>
    /// <returns></returns>
    public ActionResult CZ(string pwd)
    {
    //将字符串解析成字节数组 using System.Text;
    byte[] buffer = Encoding.Default.GetBytes(pwd);
    //使用MD5这个抽象类的Creat()方法创建一个虚拟的MD5类的对象
    MD5 md5 =MD5.Create();//using System.Security.Cryptography;
    //使用MD5实例的ComputeHash()方法处理字节数组
    byte[] bufferNew = md5.ComputeHash(buffer);
    string strNew = null;
    for (int i = 0; i < bufferNew.Length; i++)
    {
    //对bufferNew字节数组中的每个元素进行十六机制转换人后拼接成strNew字符串
    strNew += bufferNew[i].ToString("x2");
    }
    return Content("<script>alert('"+ strNew + "');location.href='/Users/Index';</script>");
    }


    方法二:(16位)

    //using System.Security.Cryptography;
    var md5 = new MD5CryptoServiceProvider();
    string t2 = BitConverter.ToString(md5.ComputeHash(Encoding.Default.GetBytes(textBox2.Text)));
    t2 = t2.Replace("-", "");

  • 相关阅读:
    Unity-WIKI 之 AllocationStats(内存分配)
    Unity-WIKI 之 DebugLine
    Unity-WIKI 之 DebugConsole
    Unity-WIKI 之 DrawArrow
    Unity 2D Sprite Lighting
    Unity 2D Touch Movement
    [Unity2D]2D Mobile Joystick
    DragRigidbody2D
    Finger Gestures 3.1
    2D Skeletal Animation Ready
  • 原文地址:https://www.cnblogs.com/LiChen19951127/p/9672441.html
Copyright © 2011-2022 走看看