public void hmacsha512Test() { string key = "key"; PasswordHasher target = new HmacSha512Hasher(); string hashedPassword = target.GetHash(@"teste", key); string validHash = @"3ec5572cbd1a609b00bec40e37ba5630b1218c146c339cdd26286ada12aebb77db9e5527c268cc04e1242b8817c26b1abc34077ea6a5702934f62d44417bdf3c"; Assert.True(target.VerifyHash(@"teste", validHash, key)); }
public void addingNewUserUserHashingFunction() { User user = new User(); UserRepository repo = new UserRepository(); PasswordHasher hasherAlgorithm = new HmacSha512Hasher(); UserManagerViewModel target = new UserManagerViewModel(user, repo, hasherAlgorithm); target.Username = "******"; target.Password = "******"; target.Realname = "Mig"; target.AddUser(); Assert.IsTrue(hasherAlgorithm.VerifyHash("teste", target.Users[0].Password, "mige")); }