Beispiel #1
0
        static void TestSha1()
        {
            String name = "Sha1";

            if (Sha1.IsSupported)
            {
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashChoose(x, 20, y), sha1cRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashParity(x, 20, y), sha1pRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashMajority(x, 20, y), sha1mRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.SchedulePart1(x, y, z), sha1su1Res);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.SchedulePart2(x, y), sha1su2Res);
                if (Sha1.FixedRotate(100) != 25)
                {
                    throw new Exception("Sha1 FixedRotate failed.\n");
                }
            }
            else
            {
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashChoose(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashParity(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashMajority(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.SchedulePart1(x, y, z));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.SchedulePart2(x, y));
            }
        }
Beispiel #2
0
        static void TestSha1()
        {
#if ARM64_SIMD_API_PENDING_APPROVAL_AND_OR_COREFX_MERGE
            String name = "Sha1";
            if (Sha1.IsSupported)
            {
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashChoose(x, 20, y), sha1cRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashParity(x, 20, y), sha1pRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.HashMajority(x, 20, y), sha1mRes);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.SchedulePart1(x, y, z), sha1su1Res);
                testCryptoOp <uint, Vector128 <uint>, uint, Vector128 <uint> >(name, (x, y, z) => Sha1.SchedulePart2(x, y), sha1su2Res);
                if (Sha1.FixedRotate(100) != 25)
                {
                    throw new Exception("Sha1 FixedRotate failed.\n");
                }
            }
            else
            {
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashChoose(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashParity(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.HashMajority(x, 20, y));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.SchedulePart1(x, y, z));
                testThrowsPlatformNotSupported <Vector128 <uint>, Vector128 <uint>  >(name, (x, y, z) => Sha1.SchedulePart2(x, y));
            }
#endif //ARM64_SIMD_API_PENDING_APPROVAL_AND_OR_COREFX_MERGE
        }