Beispiel #1
0
        public void TestHashPassword()
        {
            const string password      = "******";
            const string rightPassword = "******";
            const string wrongPassword = "******";

            byte[] salt             = PBKDF2Impl.GenerateSalt();
            byte[] encrypedPassword = PBKDF2Impl.HashPassword(Encoding.UTF8.GetBytes(password), salt);

            byte[] encrypedRightPassword = PBKDF2Impl.HashPassword(Encoding.UTF8.GetBytes(rightPassword), salt);
            byte[] encrypedWrongPassword = PBKDF2Impl.HashPassword(Encoding.UTF8.GetBytes(wrongPassword), salt);

            Assert.IsTrue(AbstractSecureCompareBase.Compare(encrypedPassword, encrypedRightPassword));
            Assert.IsFalse(AbstractSecureCompareBase.Compare(encrypedPassword, encrypedWrongPassword));
        }
Beispiel #2
0
 public bool Compare(byte[] array1, byte[] array2)
 {
     _logger.Info("compare byte arrays");
     return(AbstractSecureCompareBase.Compare(array1, array2));
 }