I have a windows application, the tartget framework is .NET Framework 4.6.1
I use c# to hash passwords. My code is
public string HashPassword(string password) { byte[] salt = new byte[128 / 8]; using (var rng = new RNGCryptoServiceProvider()) { rng.GetBytes(salt); } string hashed = ""; using (var rfc = new Rfc2898DeriveBytes(password, salt, 100000, HashAlgorithmName.SHA512)) { //logic implementation } } I got an error CS1729 'Rfc2898DeriveBytes' does not contain a constructor that takes 4 arguments.
I right click on Rfc2898DeriveBytes, then go to the Definition. In the namespace System.Security.Cryptography, there is '''public Rfc2898DeriveBytes(string password, byte[] salt, int iterations, HashAlgorithmName hashAlgorithm)''' ''' : this(new UTF8Encoding(encoderShouldEmitUTF8Identifier: false).GetBytes(password), salt, iterations, hashAlgorithm)'''
So, why I got the error message? It seems the compiler is looking at somewhere else.
Thank you
