Example #1
0
        public void Double_cross_check()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(a.Double(), a.Add(a));
        }
Example #2
0
        public void Square_cross_check()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(a.Squared(), a.Mul(a));
        }
Example #3
0
        public void Negate_negate()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(a, a.Negate().Negate());
        }
Example #4
0
        public void Inverse_mul_self()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(Fp6.One, a.Mul(a.Inverse()));
        }
Example #5
0
        public void Inverse_inverse()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(a, a.Inverse().Inverse());
        }
Example #6
0
        public void Add_negate()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Assert.AreEqual(Fp6.Zero, a.Add(a.Negate()));
            Assert.AreEqual(Fp6.Zero, a.Negate().Add(a));
        }
Example #7
0
        public void Inverse_mul_self_is_commutative_regression()
        {
            Fp2 a2 = new Fp2(Parameters.P / 2, Parameters.P / 4);
            Fp6 a  = new Fp6(a2, a2, a2);

            Assert.True(a.IsValid());

            Fp6 inv = a.Inverse();

            Assert.AreEqual(a.Mul(inv), inv.Mul(a));
        }