Ejemplo n.º 1
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));
    }
Ejemplo n.º 2
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));
        }