MD5加密

/// <summary>
        /// 加密
        /// </summary>
        /// <param name="input">加密字符串</param>
        /// <param name="input_charset">编码</param>
        /// <returns></returns>
        public static string GetMD5(string input, string input_charset) {
            MD5 mD5 = new MD5CryptoServiceProvider();
            byte[] t = mD5.ComputeHash(Encoding.GetEncoding(input_charset).GetBytes(input));
            StringBuilder str = new StringBuilder();
            for (int i = 0; i < t.Length; i++)
            {
                str.Append(t[i].ToString("x"));
            }
            return str.ToString();
        }

 

posted @ 2018-01-11 09:57  多1份努力~  阅读(175)  评论(0编辑  收藏  举报