public void TestStringCypherWithoutSalt() { IStringCypherService service = new StringCypherService(); var cyphertext = service.Encrypt(_plaintext, _password); var decrypted = service.Decrypt(cyphertext, _password); Assert.AreEqual(_plaintext, decrypted); _ = service.Decrypt(cyphertext, _badPassword); }
public void TestStringCypherWithSalt() { IStringCypherService service = new StringCypherService(); ISalter salter = new Salter(); var salt = salter.GenerateSalt(64); var cyphertext = service.Encrypt(_plaintext, _password, salt); var decrypted = service.Decrypt(cyphertext, _password, salt); Assert.AreEqual(_plaintext, decrypted); salt = salter.GenerateSalt(64); _ = service.Decrypt(cyphertext, _password, salt); }