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

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Security.Cryptography;

    namespace MD5加密练习1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("请输入字符");
                string s = Console.ReadLine();
                string md5= GetMD5(s);
                Console.WriteLine(md5);
                Console.ReadKey();
            }
            public static string GetMD5(string strPwd)
            {
                MD5 md5 = new MD5CryptoServiceProvider();
                byte[] bPwd = Encoding.UTF8.GetBytes(strPwd);
                byte[] bMD5 = md5.ComputeHash(bPwd);
                md5.Clear();
                StringBuilder sbMD5Pwd = new StringBuilder();
                for (int i = 0; i < bMD5.Length; i++)
                {
                    sbMD5Pwd.Append(bMD5[i].ToString("X2"));
                }
                return sbMD5Pwd.ToString();
            }
        }
    }

  • 相关阅读:
    如何实现Iframe透明
    ListView(未完)
    我又回来了
    前言
    代码重用and思路重用
    图片上传
    千万数量级分页存储过程
    MSSQL中,将text,ntext转换为int型数据
    优秀的回复,来自圣殿骑士
    SqlDataSource控件
  • 原文地址:https://www.cnblogs.com/HarryChis/p/10472845.html
Copyright © 2011-2022 走看看