Exemplo n.º 1
0
        private void TestGenerateSalt()
        {
            string firstSalt  = HashProfile.GenerateSalt();
            string secondSalt = HashProfile.GenerateSalt();

            Assert.NotEqual(firstSalt, secondSalt);
        }
Exemplo n.º 2
0
        private void TestValidatePasswordsTrue()
        {
            string password       = "******";
            string salt           = HashProfile.GenerateSalt();
            string hashedPassword = HashProfile.GetSaltedHashData(password, salt);

            Assert.True(HashProfile.ValidatePasswords(password, hashedPassword, salt));
        }
Exemplo n.º 3
0
        private void TestValidatePasswordsDifferentPasswords()
        {
            string password       = "******";
            string secondPassword = "******";
            string salt           = HashProfile.GenerateSalt();
            string hashedPassword = HashProfile.GetSaltedHashData(password, salt);

            Assert.False(HashProfile.ValidatePasswords(secondPassword, hashedPassword, salt));
        }
Exemplo n.º 4
0
        private void TestValidatePasswordsDifferentSalts()
        {
            string password       = "******";
            string correctSalt    = HashProfile.GenerateSalt();
            string incorrectSalt  = HashProfile.GenerateSalt();
            string hashedPassword = HashProfile.GetSaltedHashData(password, correctSalt);

            Assert.False(HashProfile.ValidatePasswords(password, hashedPassword, incorrectSalt));
        }
Exemplo n.º 5
0
        private void TestGetSaltedHashData()
        {
            string password = "******";
            string salt     = HashProfile.GenerateSalt();

            string firstSaltedHashPassword  = HashProfile.GetSaltedHashData(password, salt);
            string secondSaltedHashPassword = HashProfile.GetSaltedHashData(password, salt);

            Assert.Equal(firstSaltedHashPassword, secondSaltedHashPassword);
        }
Exemplo n.º 6
0
        private void TestGetSaltedHashDataDifferentPasswords()
        {
            string firstPassword  = "******";
            string secondPassword = "******";
            string salt           = HashProfile.GenerateSalt();

            string firstSaltedHashPassword  = HashProfile.GetSaltedHashData(firstPassword, salt);
            string secondSaltedHashPassword = HashProfile.GetSaltedHashData(secondPassword, salt);

            Assert.NotEqual(firstSaltedHashPassword, secondSaltedHashPassword);
        }