MD5加密

对PassWord进行MD5单向加密

/// <summary>
/// MD5散列
/// </summary>
public static string MD5(string inputStr)
{
  MD5 md5 = new MD5CryptoServiceProvider();
  byte[] hashByte = md5.ComputeHash(Encoding.UTF8.GetBytes(inputStr));
  StringBuilder sb = new StringBuilder();
  foreach (byte item in hashByte)
    sb.Append(item.ToString("x").PadLeft(2, '0'));
  return sb.ToString();
}

 

你可能感兴趣的:(MD5加密)