public virtual AbstractF2mPoint TauPow(int pow) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (base.IsInfinity) { return(this); } ECCurve curve = Curve; int coordinateSystem = curve.CoordinateSystem; ECFieldElement rawXCoord = base.RawXCoord; switch (coordinateSystem) { case 0: case 5: { ECFieldElement rawYCoord2 = base.RawYCoord; return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord2.SquarePow(pow), base.IsCompressed)); } case 1: case 6: { ECFieldElement rawYCoord = base.RawYCoord; ECFieldElement eCFieldElement = base.RawZCoords[0]; return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord.SquarePow(pow), new ECFieldElement[1] { eCFieldElement.SquarePow(pow) }, base.IsCompressed)); } default: throw new InvalidOperationException("unsupported coordinate system"); } }
public virtual AbstractF2mPoint TauPow(int pow) { if (base.IsInfinity) { return(this); } ECCurve curve = this.Curve; int coordinateSystem = curve.CoordinateSystem; ECFieldElement rawXCoord = base.RawXCoord; switch (coordinateSystem) { case 0: case 5: { ECFieldElement rawYCoord = base.RawYCoord; return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord.SquarePow(pow), base.IsCompressed)); } case 1: case 6: { ECFieldElement rawYCoord2 = base.RawYCoord; ECFieldElement eCFieldElement = base.RawZCoords[0]; return((AbstractF2mPoint)curve.CreateRawPoint(rawXCoord.SquarePow(pow), rawYCoord2.SquarePow(pow), new ECFieldElement[] { eCFieldElement.SquarePow(pow) }, base.IsCompressed)); } } throw new InvalidOperationException("unsupported coordinate system"); }
public virtual ECFieldElement HalfTrace() { int m = FieldSize; if ((m & 1) == 0) { throw new InvalidOperationException("Half-trace only defined for odd m"); } //ECFieldElement ht = this; //for (int i = 1; i < m; i += 2) //{ // ht = ht.SquarePow(2).Add(this); //} int n = (m + 1) >> 1; int k = 31 - Integers.NumberOfLeadingZeros(n); int nk = 1; ECFieldElement ht = this; while (k > 0) { ht = ht.SquarePow(nk << 1).Add(ht); nk = n >> --k; if (0 != (nk & 1)) { ht = ht.SquarePow(2).Add(this); } } return(ht); }
public virtual int Trace() { int m = FieldSize; //ECFieldElement tr = this; //for (int i = 1; i < m; ++i) //{ // tr = tr.Square().Add(this); //} int k = 31 - Integers.NumberOfLeadingZeros(m); int mk = 1; ECFieldElement tr = this; while (k > 0) { tr = tr.SquarePow(mk).Add(tr); mk = m >> --k; if (0 != (mk & 1)) { tr = tr.Square().Add(this); } } if (tr.IsZero) { return(0); } if (tr.IsOne) { return(1); } throw new InvalidOperationException("Internal error in trace calculation"); }
public virtual ECFieldElement HalfTrace() { int m = FieldSize; if ((m & 1) == 0) { throw new InvalidOperationException("Half-trace only defined for odd m"); } ECFieldElement fe = this; ECFieldElement ht = fe; for (int i = 2; i < m; i += 2) { fe = fe.SquarePow(2); ht = ht.Add(fe); } return(ht); }