Example #1
0
        public override ECFieldElement Add(ECFieldElement b)
        {
            LongArray       longArray       = x.Copy();
            F2mFieldElement f2mFieldElement = (F2mFieldElement)b;

            longArray.AddShiftedByWords(f2mFieldElement.x, 0);
            return(new F2mFieldElement(m, ks, longArray));
        }
Example #2
0
        public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y)
        {
            LongArray longArray  = this.x;
            LongArray longArray2 = ((F2mFieldElement)x).x;
            LongArray other      = ((F2mFieldElement)y).x;
            LongArray longArray3 = longArray.Square(this.m, this.ks);
            LongArray other2     = longArray2.Multiply(other, this.m, this.ks);

            if (longArray3 == longArray)
            {
                longArray3 = longArray3.Copy();
            }
            longArray3.AddShiftedByWords(other2, 0);
            longArray3.Reduce(this.m, this.ks);
            return(new F2mFieldElement(this.m, this.ks, longArray3));
        }
        public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y)
        {
            LongArray array  = this.x;
            LongArray array2 = ((F2mFieldElement)x).x;
            LongArray other  = ((F2mFieldElement)y).x;
            LongArray array4 = array.Square(this.m, this.ks);
            LongArray array5 = array2.Multiply(other, this.m, this.ks);

            if (array4 == array)
            {
                array4 = array4.Copy();
            }
            array4.AddShiftedByWords(array5, 0);
            array4.Reduce(this.m, this.ks);
            return(new F2mFieldElement(this.m, this.ks, array4));
        }
Example #4
0
        public override ECFieldElement SquarePlusProduct(ECFieldElement x, ECFieldElement y)
        {
            LongArray ax = this.x, xx = ((F2mFieldElement)x).x, yx = ((F2mFieldElement)y).x;

            LongArray aa = ax.Square(m, ks);
            LongArray xy = xx.Multiply(yx, m, ks);

            if (aa == ax)
            {
                aa = (LongArray)aa.Copy();
            }

            aa.AddShiftedByWords(xy, 0);
            aa.Reduce(m, ks);

            return(new F2mFieldElement(m, ks, aa));
        }
Example #5
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            LongArray ax = this.x, bx = ((F2mFieldElement)b).x, xx = ((F2mFieldElement)x).x, yx = ((F2mFieldElement)y).x;

            LongArray ab = ax.Multiply(bx, m, ks);
            LongArray xy = xx.Multiply(yx, m, ks);

            if (ab == ax || ab == bx)
            {
                ab = (LongArray)ab.Copy();
            }

            ab.AddShiftedByWords(xy, 0);
            ab.Reduce(m, ks);

            return(new F2mFieldElement(m, ks, ab));
        }
Example #6
0
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            LongArray longArray  = this.x;
            LongArray longArray2 = ((F2mFieldElement)b).x;
            LongArray longArray3 = ((F2mFieldElement)x).x;
            LongArray other      = ((F2mFieldElement)y).x;
            LongArray longArray4 = longArray.Multiply(longArray2, this.m, this.ks);
            LongArray other2     = longArray3.Multiply(other, this.m, this.ks);

            if (longArray4 == longArray || longArray4 == longArray2)
            {
                longArray4 = longArray4.Copy();
            }
            longArray4.AddShiftedByWords(other2, 0);
            longArray4.Reduce(this.m, this.ks);
            return(new F2mFieldElement(this.m, this.ks, longArray4));
        }
        public override ECFieldElement MultiplyPlusProduct(ECFieldElement b, ECFieldElement x, ECFieldElement y)
        {
            LongArray array  = this.x;
            LongArray other  = ((F2mFieldElement)b).x;
            LongArray array3 = ((F2mFieldElement)x).x;
            LongArray array4 = ((F2mFieldElement)y).x;
            LongArray array5 = array.Multiply(other, this.m, this.ks);
            LongArray array6 = array3.Multiply(array4, this.m, this.ks);

            if ((array5 == array) || (array5 == other))
            {
                array5 = array5.Copy();
            }
            array5.AddShiftedByWords(array6, 0);
            array5.Reduce(this.m, this.ks);
            return(new F2mFieldElement(this.m, this.ks, array5));
        }