Example #1
0
        public void CannotVerifyStringWithDifferentHash()
        {
            var plainText  = "beautiful";
            var target     = new BCryptHashService(_secureRandomGenerator, _encryptionService);
            var hashResult = target.GetHash(plainText);

            var actual = target.Verify("Not so good", hashResult.Hash, hashResult.Salt);

            Assert.IsFalse(actual);
        }
Example #2
0
        public void CanVerifyStringWithSameText()
        {
            var plainText  = "beautiful";
            var target     = new BCryptHashService(_secureRandomGenerator, _encryptionService);
            var hashResult = target.GetHash(plainText);

            var actual = target.Verify(plainText, hashResult.Hash, hashResult.Salt);

            Assert.IsTrue(actual);
        }