Beispiel #1
0
        public static void EstimateRankCosts(int[] widths, int[][] heights, string directory)
        {
            // Writes global parameters (cost metric, testable gates) to terminal
            DriverParameters.Print();

            System.IO.Directory.CreateDirectory(directory);

            // Loops over controlled/not and whether it counts all gates
            bool allGates     = false;
            bool isControlled = false;

            for (int j = 0; j < 2; j++)
            {
                // for (int i = 0; i < 2; i++) // no need to estimate when its controlled
                // {
                var    localControl = isControlled;
                var    localGates   = allGates;
                Thread rankThread   = new Thread(() => TwoArgResourceTest <RankResourceEstimate>(
                                                     RankResourceEstimate.Run,
                                                     widths,
                                                     heights,
                                                     localControl,
                                                     directory + "Rank",
                                                     localGates));
                rankThread.Start();
                //     isControlled = !isControlled;
                // }

                allGates = !allGates;
            }
        }
Beispiel #2
0
        public static void EstimateCipherCosts(string directory)
        {
            // Writes global parameters (cost metric, testable gates) to terminal
            DriverParameters.Print();

            System.IO.Directory.CreateDirectory(directory);
            int[]   chaskeyRounds      = { 8, 12 };
            int[]   elephantSizes      = { 160, 176, 200 };
            int[]   princeSizes        = { 64 };
            int[][] elephantGuessSizes = { new int[] { 47, 63 }, new int[] { 47, 68 }, new int[] { 69, 76 } };
            int[][] princeGuessSizes   = { new int[] { 48, 50 } };
            int[][] chaskeyGuessSizes  = { new int[] { 48, 50, 51 }, new int[] { 48, 50, 51 } };
            // Warning, longer version!
            //int[][] elephantGuessSizes = {new int[]{47, 62, 63, 64}, new int[]{47, 67, 68, 69},  new int[]{69, 75, 76, 77}};
            //int[][] princeGuessSizes = {new int[]{47, 48, 49, 50, 51, 52}};
            //int[][] chaskeyGuessSizes = {new int[]{47,48, 49, 50, 51, 52}, new int[]{47, 48, 49, 50, 51, 52}};
            // Loops over controlled/not and whether it counts all gates
            bool allGates     = false;
            bool isControlled = false;

            for (int j = 0; j < 2; j++)
            {
                // for (int i = 0; i < 2; i++)
                // {
                var    localControl  = isControlled;
                var    localGates    = allGates;
                Thread chaskeyThread = new Thread(() => TwoArgResourceTest <ChaskeyAttackEstimate>(
                                                      ChaskeyAttackEstimate.Run,
                                                      chaskeyRounds,
                                                      chaskeyGuessSizes,
                                                      localControl,
                                                      directory + "Chaskey",
                                                      localGates));
                chaskeyThread.Start();
                Thread princeThread = new Thread(() => TwoArgResourceTest <PrinceAttackEstimate>(
                                                     PrinceAttackEstimate.Run,
                                                     princeSizes,
                                                     princeGuessSizes,
                                                     localControl,
                                                     directory + "Prince",
                                                     localGates));
                princeThread.Start();
                Thread elephantThread = new Thread(() => TwoArgResourceTest <ElephantAttackEstimate>(
                                                       ElephantAttackEstimate.Run,
                                                       elephantSizes,
                                                       elephantGuessSizes,
                                                       localControl,
                                                       directory + "Elephant",
                                                       localGates));
                elephantThread.Start();
                //     isControlled = !isControlled;
                // }

                allGates = !allGates;
            }
        }
Beispiel #3
0
        public static void EstimateGroverCosts(string directory)
        {
            // Writes global parameters (cost metric, testable gates) to terminal
            DriverParameters.Print();

            System.IO.Directory.CreateDirectory(directory);
            int[]   chaskeyRounds   = { 8, 12 };
            int[][] chaskeyQueries  = { new int[] { 1, 2 }, new int[] { 1, 2 } };
            int[]   elephantSizes   = { 160, 176, 200 };
            int[][] elephantQueries = { new int[] { 1 }, new int[] { 1 }, new int[] { 1 } };
            int[]   princeSizes     = { 64 };
            int[][] princeQueries   = { new int[] { 1, 2, 3 } };

            // Loops over controlled/not and whether it counts all gates
            bool allGates     = false;
            bool isControlled = false;

            for (int j = 0; j < 2; j++)
            {
                // for (int i = 0; i < 2; i++)
                // {
                var    localControl  = isControlled;
                var    localGates    = allGates;
                Thread chaskeyThread = new Thread(() => TwoArgResourceTest <ChaskeyGroverEstimate>(
                                                      ChaskeyGroverEstimate.Run,
                                                      chaskeyRounds,
                                                      chaskeyQueries,
                                                      localControl,
                                                      directory + "Chaskey",
                                                      localGates));
                chaskeyThread.Start();
                Thread princeThread = new Thread(() => TwoArgResourceTest <PrinceGroverEstimate>(
                                                     PrinceGroverEstimate.Run,
                                                     princeSizes,
                                                     princeQueries,
                                                     localControl,
                                                     directory + "Prince",
                                                     localGates));
                princeThread.Start();
                Thread elephantThread = new Thread(() => TwoArgResourceTest <ElephantGroverEstimate>(
                                                       ElephantGroverEstimate.Run,
                                                       elephantSizes,
                                                       elephantQueries,
                                                       localControl,
                                                       directory + "Elephant",
                                                       localGates));
                elephantThread.Start();
                //     isControlled = !isControlled;
                // }

                allGates = !allGates;
            }
        }
Beispiel #4
0
        public static void EstimateFullCipherCosts(string directory)
        {
            // Writes global parameters (cost metric, testable gates) to terminal
            DriverParameters.Print();

            System.IO.Directory.CreateDirectory(directory);
            int[] chaskeyRounds = { 8, 12 };
            int[] elephantSizes = { 160, 176, 200 };
            int[] princeSizes   = { 64 };
            // Loops over controlled/not and whether it counts all gates
            bool allGates     = false;
            bool isControlled = false;

            for (int j = 0; j < 2; j++)
            {
                // for (int i = 0; i < 2; i++)
                // {
                var    localControl  = isControlled;
                var    localGates    = allGates;
                Thread chaskeyThread = new Thread(() => BasicResourceTest <FullChaskeyAttackEstimate>(
                                                      FullChaskeyAttackEstimate.Run,
                                                      chaskeyRounds,
                                                      localControl,
                                                      directory + "Chaskey",
                                                      localGates,
                                                      false));
                chaskeyThread.Start();
                Thread princeThread = new Thread(() => BasicResourceTest <FullPrinceAttackEstimate>(
                                                     FullPrinceAttackEstimate.Run,
                                                     princeSizes,
                                                     localControl,
                                                     directory + "Prince",
                                                     localGates,
                                                     false));
                princeThread.Start();
                Thread elephantThread = new Thread(() => BasicResourceTest <FullElephantAttackEstimate>(
                                                       FullElephantAttackEstimate.Run,
                                                       elephantSizes,
                                                       localControl,
                                                       directory + "Elephant",
                                                       localGates,
                                                       false));
                elephantThread.Start();
                //     isControlled = !isControlled;
                // }

                allGates = !allGates;
            }
        }