转:system.Security.Cryptography C# 加密和解密(6)

3.Hash散列举例
...{
   System.Security.Cryptography.HashAlgorithm
      System.Security.Cryptography.KeyedHashAlgorithm
      System.Security.Cryptography.MD5
      System.Security.Cryptography.SHA1
      System.Security.Cryptography.SHA256
      System.Security.Cryptography.SHA384
      System.Security.Cryptography.SHA512
}
public static string Encrypt(string password) 
...{
password = password.ToLower();

Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);

return BitConverter.ToString(hashedBytes);
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/46bbcb8eb1be1abc5d67a31a1652636a.html