Question
write the working , result and conclusion of the given code. public static class Hashing { public static string Salt() { byte[] salt = new
write the working , result and conclusion of the given code.
public static class Hashing { public static string Salt() { byte[] salt = new byte[128 / 8]; using (var rng = RandomNumberGenerator.Create()) { rng.GetBytes(salt); } return Convert.ToBase64String(salt); } public static string HashPassword(string password, string salt) { string hashed = Convert.ToBase64String(KeyDerivation.Pbkdf2( password, Convert.FromBase64String(salt), KeyDerivationPrf.HMACSHA1, 10000, 256 / 8 )); return hashed; }
public static bool VerifyPassword(string password, string hash, string salt) { string hashedPassword = Convert.ToBase64String(KeyDerivation.Pbkdf2( password, Convert.FromBase64String(salt), KeyDerivationPrf.HMACSHA1, 10000, 256 / 8 )); return hash == hashedPassword; } private static readonly byte[] Pepper = ConvertSpacedHexToByteArray(ConfigurationManager.AppSettings["Pepper"]); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started