public override ECFieldElement Add(ECFieldElement b) { uint[] z = Nat192.Create(); SecP192R1Field.Add(x, ((SecP192R1FieldElement)b).x, z); return(new SecP192R1FieldElement(z)); }
public override ECPoint Twice() { if (base.IsInfinity) { return(this); } ECCurve curve = Curve; SecP192R1FieldElement secP192R1FieldElement = (SecP192R1FieldElement)base.RawYCoord; if (secP192R1FieldElement.IsZero) { return(curve.Infinity); } SecP192R1FieldElement secP192R1FieldElement2 = (SecP192R1FieldElement)base.RawXCoord; SecP192R1FieldElement secP192R1FieldElement3 = (SecP192R1FieldElement)base.RawZCoords[0]; uint[] array = Nat192.Create(); uint[] array2 = Nat192.Create(); uint[] array3 = Nat192.Create(); SecP192R1Field.Square(secP192R1FieldElement.x, array3); uint[] array4 = Nat192.Create(); SecP192R1Field.Square(array3, array4); bool isOne = secP192R1FieldElement3.IsOne; uint[] array5 = secP192R1FieldElement3.x; if (!isOne) { array5 = array2; SecP192R1Field.Square(secP192R1FieldElement3.x, array5); } SecP192R1Field.Subtract(secP192R1FieldElement2.x, array5, array); uint[] array6 = array2; SecP192R1Field.Add(secP192R1FieldElement2.x, array5, array6); SecP192R1Field.Multiply(array6, array, array6); uint x = Nat192.AddBothTo(array6, array6, array6); SecP192R1Field.Reduce32(x, array6); uint[] array7 = array3; SecP192R1Field.Multiply(array3, secP192R1FieldElement2.x, array7); x = Nat.ShiftUpBits(6, array7, 2, 0u); SecP192R1Field.Reduce32(x, array7); x = Nat.ShiftUpBits(6, array4, 3, 0u, array); SecP192R1Field.Reduce32(x, array); SecP192R1FieldElement secP192R1FieldElement4 = new SecP192R1FieldElement(array4); SecP192R1Field.Square(array6, secP192R1FieldElement4.x); SecP192R1Field.Subtract(secP192R1FieldElement4.x, array7, secP192R1FieldElement4.x); SecP192R1Field.Subtract(secP192R1FieldElement4.x, array7, secP192R1FieldElement4.x); SecP192R1FieldElement secP192R1FieldElement5 = new SecP192R1FieldElement(array7); SecP192R1Field.Subtract(array7, secP192R1FieldElement4.x, secP192R1FieldElement5.x); SecP192R1Field.Multiply(secP192R1FieldElement5.x, array6, secP192R1FieldElement5.x); SecP192R1Field.Subtract(secP192R1FieldElement5.x, array, secP192R1FieldElement5.x); SecP192R1FieldElement secP192R1FieldElement6 = new SecP192R1FieldElement(array6); SecP192R1Field.Twice(secP192R1FieldElement.x, secP192R1FieldElement6.x); if (!isOne) { SecP192R1Field.Multiply(secP192R1FieldElement6.x, secP192R1FieldElement3.x, secP192R1FieldElement6.x); } return(new SecP192R1Point(curve, secP192R1FieldElement4, secP192R1FieldElement5, new ECFieldElement[1] { secP192R1FieldElement6 }, base.IsCompressed)); }