Beispiel #1
0
        internal static void AssertHashValueIsEqualsToDotNetImplementation(Core.CryptoSystems.HashAlgorithm algorithmUnderTest, Core.CryptoSystems.HashAlgorithm verificationAlgorithm, string input)
        {
            // arrange
            byte[] inputAsByteArray = Core.Miscellaneous.Utilities.StringToByteArray(input);
            byte[] expectedResult   = verificationAlgorithm.Hash(inputAsByteArray);

            // act
            byte[] actualResult = algorithmUnderTest.Hash(inputAsByteArray);

            // assert
            Assert.IsTrue(expectedResult.SequenceEqual(actualResult));
        }
Beispiel #2
0
 internal static void AssertSHA256ValueIsEqualsToDotNetImplementation(Core.CryptoSystems.HashAlgorithm algorithmUnderTest, string input)
 {
     AssertHashValueIsEqualsToDotNetImplementation(algorithmUnderTest, new Core.CryptoSystems.ConcreteHashAlgorithms.SHA256(), input);
 }