public void FactoryMethodShouldThrowException() { const string plaintext = "F0o!"; const int iterations = 1; Assert.Throws <ArgumentException>(() => PasswordHash.From(plaintext, iterations, 7)); }
public void FactoryMethodShouldThrowException() { const string plaintext = "F0o!"; const int iterations = 0; const int bits = 256; Assert.Throws <ArgumentOutOfRangeException>(() => PasswordHash.From(plaintext, iterations, bits / 8)); }
public void FactoryMethodShouldThrowException() { const string plaintext = null; const int iterations = 1000; const int bits = 256; Assert.Throws <ArgumentNullException>(() => PasswordHash.From(plaintext, iterations, bits / 8)); }
public void ItShouldMatch() { const string plaintext = "Fo0!"; const int iterations = 1000; const int bits = 256; var hash = PasswordHash.From(plaintext, iterations, bits / 8); Assert.True(hash.IsMatch(plaintext)); }
public void ItShouldFailToMatch() { const string plaintext = "Fo0!"; const string incorrectPlaintext = "b4r1"; const int iterations = 1000; const int bits = 256; var hash = PasswordHash.From(plaintext, iterations, bits / 8); Assert.False(hash.IsMatch(incorrectPlaintext)); }
public PasswordHash StaticFactory() => PasswordHash.From("Testing!234", Iterations, HashSize / 8);