コード例 #1
0
        public void Same_Salt_And_Same_PlainText_Returns_Verify_True()
        {
            // Arrange
            var salt      = HashingManager.CreateSalt();
            var plainText = "Password1!";

            // Act
            var saltedHash = HashingManager.ComputeHash(plainText, salt, HashAlgo.SHA256);
            var verify     = HashingManager.Verify(plainText, salt, HashAlgo.SHA256, saltedHash);

            // Assert
            Assert.IsTrue(verify);
        }
コード例 #2
0
        public void Same_Salt_And_Different_PlainText_Returns_Verify_False()
        {
            // Arrange
            var salt = HashingManager.CreateSalt();
            var originalPlainText  = "Password1!";
            var differentPlainText = "Password2!";

            // Act
            var saltedHash = HashingManager.ComputeHash(originalPlainText, salt, HashAlgo.SHA256);
            var verify     = HashingManager.Verify(differentPlainText, salt, HashAlgo.SHA256, saltedHash);

            // Assert
            Assert.IsFalse(verify);
        }