public void PbkdfStringWithSaltIteration() { // Arrange CryptographyFactory f = new CryptographyFactory(); // Act int iterationCount = 3050; byte[] saltBytes = Convert.FromBase64String("cPpP4ISgNAIuMZGncgwlCHvE0bf0JQdWrZPXoH+g4e8="); byte[] resultBytes = f.PasswordBasedKey(10, "Hello world", saltBytes, iterationCount); string saltBase64 = Convert.ToBase64String(saltBytes); string resultBase64 = Convert.ToBase64String(resultBytes); //Console.WriteLine("salt Base64[{0}]", saltBase64); //Console.WriteLine("resultBase64[{0}]", resultBase64); //Console.WriteLine("iterationCount[{0}]", iterationCount); //Assert.Fail(); // Assert //Assert.AreEqual("ZOyIygCyaOW6GjVnihtTFtIS9PNmskdyMlNKiuyjfzw=", result); //Assert.NotZero(saltBase64.Length); //Assert.NotZero(resultBase64.Length); Assert.AreEqual("sMYk7SkvF9PElA==", resultBase64); }
public void PbkdfStringNoSaltIteration() { // Arrange CryptographyFactory f = new CryptographyFactory(); // Act int iterationCount; byte[] saltBytes; byte[] resultBytes = f.PasswordBasedKey(10, "Hello world", out saltBytes, out iterationCount); string saltBase64 = Convert.ToBase64String(saltBytes); string resultBase64 = Convert.ToBase64String(resultBytes); //Console.WriteLine("salt Base64[{0}]", saltBase64); //Console.WriteLine("resultBase64[{0}]", resultBase64); //Console.WriteLine("iterationCount[{0}]", iterationCount); //Assert.Fail(); // Assert //Assert.AreEqual("ZOyIygCyaOW6GjVnihtTFtIS9PNmskdyMlNKiuyjfzw=", result); Assert.NotZero(saltBase64.Length); Assert.NotZero(resultBase64.Length); }