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);
  }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章