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

namespace LZBS.Common
{
    public class Md5Encrypt
    {
        /// <summary>
        /// 获取一个经过加密后的结果字符串
        /// </summary>
        /// <param name="input">要加密的字符串</param>
        /// <returns>返回一个经过MD5加密后的结果字符串</returns>
        public static string GetMd5Hash(string input)
        {
            MD5 md5Hasher = MD5.Create();
            byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < data.Length; i++)
            {
                sb.Append(data[i].ToString("x2"));
            }
            return sb.ToString();
        }
    }
}
