Example #1
0
        public void HmacShaTest(int bitness, string inputHex, string keyHex, string expectedHex)
        {
            var keyBytes      = CallbackUtils.GetBytesFromHex(keyHex);
            var inputBytes    = CallbackUtils.GetBytesFromHex(inputHex);
            var expectedBytes = CallbackUtils.GetBytesFromHex(expectedHex);

            var resultBytes = HmacShaCallbacks.CalculateHash(keyBytes, inputBytes, bitness);

            resultBytes.Should().Equal(expectedBytes);
        }
Example #2
0
        public void HmacShaTest(int bitness, string inputHex, string keyHex, string expectedHex)
        {
            var keyBytes      = CallbackUtils.GetBytesFromHex(keyHex);
            var inputBytes    = CallbackUtils.GetBytesFromHex(inputHex);
            var expectedBytes = CallbackUtils.GetBytesFromHex(expectedHex);

#if !NETCOREAPP1_1
            var resultBytes = HmacShaCallbacks.CalculateHash(keyBytes, inputBytes, bitness);
            resultBytes.Should().Equal(expectedBytes);
#else
            var exception = Record.Exception(() => HmacShaCallbacks.CalculateHash(keyBytes, inputBytes, bitness));
            exception.Should().BeOfType <System.PlatformNotSupportedException>();
#endif
        }