Пример #1
0
        static void Main(string[] args)
        {
            var mode = "benchmark";

            //"sign";
            //"compare";

            if (mode == "benchmark")
            {
                var summary = BenchmarkRunner.Run <TestCases>();
            }
            else if (mode == "sign")
            {
                int falseCounter = 0, trueCounter = 0;
                for (int i = 0; i < 150; i++)
                {
                    var(publicKey1, secretKey1) = PlainScheme.GenerateKeys();
                    var sign1 = PlainScheme.Sign(secretKey1, "Hello");

                    //Console.WriteLine(PlainScheme.Verify(publicKey1, sign1, "Hello"));
                    var result = PlainScheme.Verify(publicKey1, sign1, "Hello");

                    if (result)
                    {
                        trueCounter++;
                    }
                    else
                    {
                        falseCounter++;
                    }
                }

                Console.WriteLine("True/False: {0}/{1}", trueCounter, falseCounter);
            }
            else if (mode == "compare")
            {
                var num1    = BigInteger.Parse("141562178236123719023182636512735127318231273816231730913");
                var num2    = BigInteger.Parse("9573092321784619475983727739052210384891203183287482102384");
                var modulus = BigInteger.Parse("69457109491271640540324213238132238195765914719571218");
                Plain.Static.P = modulus;
                var matr = Utils.GenerateMatrix();

                for (int i = 0; i < 100000; i++)
                {
                }
            }
        }
Пример #2
0
 public IEnumerable <object[]> VerifyArgs()
 {
     yield return(new object[] { PlainScheme.GenerateKeys().Item1, PlainScheme.Sign(PlainScheme.GenerateKeys().Item2, "Hello") });
 }
Пример #3
0
 public void UsePlainSign(SecretKey secretKey)
 {
     PlainScheme.Sign(secretKey, "Hello");
 }