public void TooHighComplexityPasswordTest() { string password = "******"; PasswordHashing provider = new PasswordHashing(complexity: 25); string hash = provider.Compute(password); }
public void NullPasswordTest() { string password = null; PasswordHashing provider = new PasswordHashing(); string hash = provider.Compute(password); }
public void WhitespacePasswordTest() { string password = "******"; PasswordHashing provider = new PasswordHashing(); string hash = provider.Compute(password); }
public void PositivePBKDF1CompareTest() { string password = "******"; PasswordHashing provider = new PasswordHashing(algorithm: PasswordHashing.ALGORITHM.PBKDF1); string hash = provider.Compute(password); bool result = provider.Compare(password, hash); Assert.IsTrue(result); }
public void PositiveCompareTest() { string password = "******"; PasswordHashing provider = new PasswordHashing(); string hash = provider.Compute(password); bool result = provider.Compare(password, hash); Assert.IsTrue(result); }
public void NegativeCompareTest() { string password = "******"; string wrongPassword = "******"; PasswordHashing provider = new PasswordHashing(); string hash = provider.Compute(password); bool result = provider.Compare(wrongPassword, hash); Assert.IsFalse(result); }
public void MaximumComplexityPasswordTest() { int expected = 16777216; string password = "******"; PasswordHashing provider = new PasswordHashing(complexity: 24); string hash = provider.Compute(password); HashedPassword hashed = (HashedPassword)hash; Assert.AreEqual(expected, hashed.Iterations); }
public void ComplexityTimeIncreasePasswordTest() { string password = "******"; PasswordHashing provider; string hash; Stopwatch sw; long first, second, third; provider = new PasswordHashing(complexity: 10); sw = Stopwatch.StartNew(); hash = provider.Compute(password); sw.Stop(); first = sw.ElapsedTicks; provider = new PasswordHashing(complexity: 11); sw = Stopwatch.StartNew(); hash = provider.Compute(password); sw.Stop(); second = sw.ElapsedTicks; provider = new PasswordHashing(complexity: 12); sw = Stopwatch.StartNew(); hash = provider.Compute(password); sw.Stop(); third = sw.ElapsedTicks; Assert.IsTrue(first < second); Assert.IsTrue(second < third); }