Пример #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));
    }
Пример #2
0
        public override ECFieldElement Add(
            ECFieldElement b)
        {
            // No check performed here for performance reasons. Instead the
            // elements involved are checked in ECPoint.F2m
            // checkFieldElements(this, b);
            LongArray       iarrClone = this.x.Copy();
            F2mFieldElement bF2m      = (F2mFieldElement)b;

            iarrClone.AddShiftedByWords(bF2m.x, 0);
            return(new F2mFieldElement(m, ks, iarrClone));
        }
Пример #3
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(m, ks);
        LongArray other2     = longArray2.Multiply(other, m, ks);

        if (longArray3 == longArray)
        {
            longArray3 = longArray3.Copy();
        }
        longArray3.AddShiftedByWords(other2, 0);
        longArray3.Reduce(m, ks);
        return(new F2mFieldElement(m, ks, longArray3));
    }
Пример #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));
        }
Пример #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));
        }
Пример #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, m, ks);
        LongArray other2     = longArray3.Multiply(other, m, ks);

        if (longArray4 == longArray || longArray4 == longArray2)
        {
            longArray4 = longArray4.Copy();
        }
        longArray4.AddShiftedByWords(other2, 0);
        longArray4.Reduce(m, ks);
        return(new F2mFieldElement(m, ks, longArray4));
    }