Search code examples
c#.netvisual-studiocryptoapi

Visual Studio doen't show all constructors for Rfc2898DeriveBytes


I am using Rfc2898DeriveBytes class for hashing passwords. And I want to use constructor which changes hashing function (MSDN), but Visual studio is saying that constructor doesn't exist and only shows constructors with three parameters.

Previously I was using the version with three parameters which worked.

new Rfc2898DeriveBytes(pass, salt, m_iterations);

This works fine.

new Rfc2898DeriveBytes(pass, salt, m_iterations, HashAlgorithmName.SHA256);

This should work, but doesn't


Solution

  • These overloads were added in .NET 4.7.2, .NET Core 2.0, and .NET Standard 2.1 (preview) - you can check this by using the .NET version selector in the top left.

    Make sure your project is targeting one of these versions, or higher.