public void GenerateSalt_called_repeatedly_with_same_password_returns_different_salts() { // arrange CryptoService cryptoService = new CryptoService(); // act string salt1 = cryptoService.GenerateSalt("password"); string salt2 = cryptoService.GenerateSalt("password"); // assert Assert.That(salt1, Is.Not.Null.Or.Empty); Assert.That(salt2, Is.Not.Null.Or.Empty); Assert.That(salt1 != salt2); }
public void GenerateSalt_given_null_or_whitespace_password_throws_ArgumentException(string password) { // arrange CryptoService cryptoService = new CryptoService(); // assert Assert.Throws<ArgumentException>(() => cryptoService.GenerateSalt(password)); }
public void GenerateSalt_given_password_returns_salt() { // arrange CryptoService cryptoService = new CryptoService(); // act string salt = cryptoService.GenerateSalt("password"); // assert Assert.That(salt, Is.Not.Null.Or.Empty); }
public void Generator() { CryptoService cryptoService = new CryptoService(); const string password = "******"; string salt = cryptoService.GenerateSalt(password); string hash = cryptoService.ComputeHash(salt, password); Console.WriteLine("{0} {1}", salt, hash); }