zoukankan      html  css  js  c++  java
  • MD5

    public class MD5
        {
            public static string MD5Encrypt32(string sDataIn)
            {
                if (String.IsNullOrEmpty(sDataIn))
                    return "";
                var b = Encoding.UTF8.GetBytes(sDataIn);
                var _md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
                byte[] output = _md5.ComputeHash(b);
                string md5Str = BitConverter.ToString(output).Replace("-", "").ToLower();
                return md5Str;
                //string pwd = "";
                //System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); //实例化一个md5对像
                //                        // 加密后是一个字节类型的数组,这里要注意编码UTF8/Unicode等的选择 
                //byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(sDataIn));
                //// 通过使用循环,将字节类型的数组转换为字符串,此字符串是常规字符格式化所得
                //for (int i = 0; i < s.Length; i++)
                //{
                //    // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符 
                //    pwd = pwd + s[i].ToString("X");
                //}
                //return pwd;
            }
        }
  • 相关阅读:
    1010考试T1
    P5631 最小mex生成树 分治 并查集
    P4366 [Code+#4]最短路 建图 最短路
    P1654 OSU! 期望概率DP
    7.26集训
    7.25集训
    7.23集训
    7.22集训
    7.21test
    7.12test
  • 原文地址:https://www.cnblogs.com/GarsonZhang/p/14252883.html
Copyright © 2011-2022 走看看