public void Should_hash_password() { ICryptographer cryptographer = new Cryptographer(); var hash = cryptographer.GetPasswordHash("pass", "salt"); Assert.That(hash, Is.EqualTo("cGS5SkKWZQ/PWvQvJaQfXnAAD7FAuqVmI8302iorwl8NtRaPV7Hr2WsQxAc3wacyhZByZfYZrIWygc0vxfQgfQ==")); }
public void Should_create_salt() { ICryptographer cryptographer = new Cryptographer(); var salt = cryptographer.CreateSalt(); Assert.That(salt.Length, Is.EqualTo(88)); }
private User[] CreateUsers() { var crypto = new Cryptographer(); string salt = crypto.CreateSalt(); return new[] { new User { Name = "Joe User", Username = "******", EmailAddress = "*****@*****.**", PasswordHash = crypto.GetPasswordHash("password", salt), PasswordSalt = salt, }, new User { Name = "Jeffrey Palermo", EmailAddress = "*****@*****.**", Username = "******", PasswordHash = crypto.GetPasswordHash("beer", salt), PasswordSalt = salt, }, new User { Name = "Homer Simpson", EmailAddress = "*****@*****.**", Username = "******", PasswordHash = crypto.GetPasswordHash("beer", salt), PasswordSalt = salt, }, new User { Name = "Bart Simpson", EmailAddress = "*****@*****.**", Username = "******", PasswordHash = crypto.GetPasswordHash("beer", salt), PasswordSalt = salt, } }; }