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

namespace Bailun.DC.Common
{
    public class CommonHelper
    {
        /// <summary>
        /// MD5　32位加密
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static string md5Encrypt(string encryptString)
        {
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] data = md5.ComputeHash(Encoding.UTF8.GetBytes(encryptString));
            string sb = "";
            for (int i = 0; i < data.Length; i++)
            {
                sb += Convert.ToString(data[i], 16).PadLeft(2, '0');
            }
            sb = sb.PadLeft(32, '0');
            return sb;
        }
    }
}
