C#MD5

  /// <summary>
  /// 以MD5的方式加密指定字符串
  /// </summary>
  /// <param name="cleanString"></param>
  /// <returns></returns>
  public static string Encrypt(string cleanString)
  {
         Byte[] clearBytes = new UnicodeEncoding().GetBytes(cleanString);
         Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
   
         return BitConverter.ToString(hashedBytes);
  }

猜你喜欢

转载自blog.csdn.net/sollin/article/details/4689178