zoukankan      html  css  js  c++  java
  • md5

    /*******************************************************
     * 
     * 作者:朱皖苏
     * 创建日期:20180521
     * 说明:此文件只包含一个类,具体内容见类型注释。
     * 运行环境:.NET 4.0
     * 版本号:1.0.0
     * 
     * 历史记录:
     * 创建文件 朱皖苏 20180521 20:09
     * 
    *******************************************************/
    
    using System.Security.Cryptography;
    using System.Text;
    
    namespace Dben.CommonLib.Cryptography
    {
        /// <summary>
        /// MD 5 加密
        /// </summary>
        public sealed class MD5Encryption
        {
    
            /// <summary>
            /// md5加密
            /// </summary>
            /// <param name="eCode"></param>
            /// <param name="sourceStr">Source String</param>
            /// <returns>MD5 hashString</returns>
            public static string GetMd5Str(Encoding eCode, string sourceStr)
            {
                byte[] bytes = eCode.GetBytes(sourceStr);
                byte[] md5Bytes = MD5.Create().ComputeHash(bytes);
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < md5Bytes.Length; i++)
                {
                    sb.Append(md5Bytes[i].ToString("x2"));
                }
                return sb.ToString();
            }
    
        }
    }
  • 相关阅读:
    类和对象
    使用JAVA理解程序逻辑
    类的有参
    1.人机猜拳
    类的无参方法
    类和对象
    Java解析XML
    集合框架一
    Java中的包
    继承
  • 原文地址:https://www.cnblogs.com/zhuwansu/p/10836968.html
Copyright © 2011-2022 走看看