Beispiel #1
0
        public void Test_01_Inverse()
        {
            PrimeFieldCurve C = new NistP256();
            int             i;

            for (i = 0; i < 1000; i++)
            {
                BigInteger k    = EllipticCurve.ToInt(C.GenerateSecret());
                BigInteger kInv = C.ModulusP.Invert(k);
                Assert.IsTrue(kInv >= BigInteger.One);
                Assert.IsTrue(kInv < C.Prime);

                BigInteger Mul = C.ModulusP.Multiply(k, kInv);

                Assert.IsTrue(Mul.IsOne);
            }
        }