Esempio n. 1
0
        private static string BenchmarkPrimeToPersistenceStorage(int MinN, int MaxN, int MinK, int MaxK, int step, string[] Keys)
        {
            ///define the chunk sizes here for the experiment
            int[] Chunks = new int[] {
                1
                , 2,
                4,
                8
                , 16
                , 32
                , 64
                , 128
                , 256
            };



            //int MaxN = 100;
            //int MaxK = 60;
            //int step = 5;
            int iterate = 100;
            ShamirAntixBenchmark benchmark = new ShamirAntixBenchmark();
            //define the key size to experiment here
            //String key = benchmark.key256bit;

            var reports = benchmark.BenchmarkPrimeWithChunkSize(Chunks, MinN, MaxN, MinK, MaxK, Keys, step, SecretSharingBenchmarkReport.OperationType.ShareGeneration
                                                                | SecretSharingBenchmarkReport.OperationType.SecretReconstruction
                                                                , iterate);
            var serializer           = new XMLSerializer <PersistanceReport>();
            PersistanceReport report = new PersistanceReport();

            report.Reports = reports.ToList();
            report.N       = MaxN;
            report.K       = MaxK;
            report.Iterate = iterate;
            report.Step    = step;
            //report.KeySize = key.Length * 8;

            string filePath = string.Format("SerializedReports-prime-n{0}-k{1}-iterate{2}.xml"
                                            , /*key.Length * 8*/ MaxN, MaxK, iterate);

            serializer.Serialize(report, filePath);
            return(filePath);
        }
Esempio n. 2
0
        private static string BenchmarkToPersistenceStorage(int MinN, int MaxN, int MinK, int MaxK, int step, string[] Keys
                                                            , SecretSharing.Benchmark.SecretSharingBenchmarkReport.SSAlgorithm alg, List <LoadedPrimeNumber> loadedPrimes)
        {
            ///define the chunk sizes here for the experiment
            int[] Chunks = new int[] {
                1
                , 2,
                4,
                8
                , 16
                , 32
                , 64
                , 128
                , 256
            };



            //int MaxN = 100;
            //int MaxK = 60;
            //int step = 5;
            int iterate = 0;

            //define the key size to experiment here
            //String key = benchmark.key256bit;
            var reports = new List <SecretSharingBenchmarkReport>();

            if (alg == SecretSharingBenchmarkReport.SSAlgorithm.Shamir)
            {
                iterate = 100;
                ShamirAntixBenchmark benchmark = new ShamirAntixBenchmark();
                reports = benchmark.BenchmarkAllKeysWithChunkSize(Chunks, MinN, MaxN, MinK, MaxK, Keys, step, SecretSharingBenchmarkReport.OperationType.ShareGeneration
                                                                  | SecretSharingBenchmarkReport.OperationType.SecretReconstruction
                                                                  , iterate, loadedPrimes);
            }
            else if (alg == SecretSharingBenchmarkReport.SSAlgorithm.Schoenmakers)
            {
                SchoenmakersBenchmark benchmark = new SchoenmakersBenchmark();
                iterate = 10;
                reports = benchmark.BenchmarkAllKeys(MinN, MaxN, MinK, MaxK, Keys, step, SecretSharingBenchmarkReport.OperationType.InitProtocol |
                                                     SecretSharingBenchmarkReport.OperationType.RandomSecretReconstruction | SecretSharingBenchmarkReport.OperationType.ShareGenerationRandomSecret
                                                     | SecretSharingBenchmarkReport.OperationType.ShareGenerationSpecialSecret | SecretSharingBenchmarkReport.OperationType.SpecialSecretReconstruction
                                                     | SecretSharingBenchmarkReport.OperationType.VerifyPooledShares | SecretSharingBenchmarkReport.OperationType.VerifyShares
                                                     | SecretSharingBenchmarkReport.OperationType.DecryptShares
                                                     , iterate, loadedPrimes);
            }
            var serializer           = new XMLSerializer <PersistanceReport>();
            PersistanceReport report = new PersistanceReport();

            report.Reports = reports.ToList();
            report.N       = MaxN;
            report.K       = MaxK;
            report.Iterate = iterate;
            report.Step    = step;
            //report.KeySize = key.Length * 8;

            string filePath = string.Format("SerializedReports-n{0}-k{1}-iterate{2}-alg{3}-{4}.xml"
                                            , /*key.Length * 8*/ MaxN, MaxK, iterate, alg.ToString(), DateTime.Now.Ticks.ToString());

            serializer.Serialize(report, filePath);
            return(filePath);
        }