コード例 #1
0
        private static void HashPasswordFromTestPBKDF(string passwordToHash, int numberOfIterations)
        {
            var sw = new Stopwatch();

            sw.Start();

            var hashedPassword = PBKDF2.HashPasswordWithPBKDF(
                Encoding.UTF8.GetBytes(passwordToHash),
                PBKDF2.GenerateSalt(),
                numberOfIterations
                );

            sw.Stop();

            Console.WriteLine();
            Console.WriteLine($"Password to hash: {passwordToHash}");
            Console.WriteLine($"Hashed Password: {Convert.ToBase64String(hashedPassword)}");
            Console.WriteLine($"Iterations <{numberOfIterations}> | Elapsed Time: {sw.ElapsedMilliseconds}");
        }