md5加密方法

using System.Security.Cryptography;

        
/// <summary>
        
/// MD5算法加密字符串
        
/// </summary>
        
/// <param name="input">待加密字符串</param>
        
/// <returns>返回加密字符串</returns>

        public static string MD5String(string input)
        
{
            
string md5;

            
using (MD5CryptoServiceProvider hashmd5 = new MD5CryptoServiceProvider())
            
{
                
byte[] data = hashmd5.ComputeHash(Encoding.Default.GetBytes(input));
                md5 
= BitConverter.ToString(data).Replace("-""").ToLower();

            }

            
return md5;
        }
 
原文地址:https://www.cnblogs.com/ghx88/p/625585.html