public virtual bool Equals(ECPoint other) { if (this == other) { return(true); } if (other == null) { return(false); } ECCurve curve = Curve; ECCurve curve2 = other.Curve; bool flag = null == curve; bool flag2 = null == curve2; bool isInfinity = IsInfinity; bool isInfinity2 = other.IsInfinity; if (isInfinity || isInfinity2) { return(isInfinity && isInfinity2 && (flag || flag2 || curve.Equals(curve2))); } ECPoint eCPoint = this; ECPoint eCPoint2 = other; if (!flag || !flag2) { if (flag) { eCPoint2 = eCPoint2.Normalize(); } else if (flag2) { eCPoint = eCPoint.Normalize(); } else { if (!curve.Equals(curve2)) { return(false); } ECPoint[] array = new ECPoint[2] { this, curve.ImportPoint(eCPoint2) }; curve.NormalizeAll(array); eCPoint = array[0]; eCPoint2 = array[1]; } } return(eCPoint.XCoord.Equals(eCPoint2.XCoord) && eCPoint.YCoord.Equals(eCPoint2.YCoord)); }
public virtual bool Equals(ECPoint other) { if (this == other) { return(true); } if (other == null) { return(false); } ECCurve curve = this.Curve; ECCurve curve2 = other.Curve; bool flag = null == curve; bool flag2 = null == curve2; bool isInfinity = this.IsInfinity; bool flag4 = other.IsInfinity; if (isInfinity || flag4) { return((isInfinity && flag4) && ((flag || flag2) || curve.Equals(curve2))); } ECPoint point = this; ECPoint p = other; if (!flag || !flag2) { if (flag) { p = p.Normalize(); } else if (flag2) { point = point.Normalize(); } else { if (!curve.Equals(curve2)) { return(false); } ECPoint[] points = new ECPoint[] { this, curve.ImportPoint(p) }; curve.NormalizeAll(points); point = points[0]; p = points[1]; } } return(point.XCoord.Equals(p.XCoord) && point.YCoord.Equals(p.YCoord)); }
public static ECPoint ImportPoint(ECCurve c, ECPoint p) { ECCurve other = p.Curve; if (!c.Equals(other)) { throw new ArgumentException("Point must be on the same curve"); } return(c.ImportPoint(p)); }
public static ECPoint CleanPoint(ECCurve c, ECPoint p) { ECCurve cp = p.Curve; if (!c.Equals(cp)) { throw new ArgumentException("Point must be on the same curve", "p"); } return(c.DecodePoint(p.GetEncoded(false))); }
public static ECPoint ImportPoint(ECCurve c, ECPoint p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) ECCurve curve = p.Curve; if (!c.Equals(curve)) { throw new ArgumentException("Point must be on the same curve"); } return(c.ImportPoint(p)); }
public static ECPoint SumOfTwoMultiplies(ECPoint P, BigInteger a, ECPoint Q, BigInteger b) { ECCurve c = P.Curve; if (!c.Equals(Q.Curve)) { throw new ArgumentException("P and Q must be on same curve"); } // Point multiplication for Koblitz curves (using WTNAF) beats Shamir's trick if (c is F2mCurve) { F2mCurve f2mCurve = (F2mCurve)c; if (f2mCurve.IsKoblitz) { return(P.Multiply(a).Add(Q.Multiply(b))); } } return(ImplShamirsTrick(P, a, Q, b)); }
public static ECPoint SumOfTwoMultiplies(ECPoint P, BigInteger a, ECPoint Q, BigInteger b) { ECCurve c = P.Curve; if (!c.Equals(Q.Curve)) { throw new ArgumentException("P and Q must be on same curve"); } // TODO Put back in once WTNAF F2m point multiplication is enabled // // Point multiplication for Koblitz curves (using WTNAF) beats Shamir's trick // if (c is F2mCurve) // { // F2mCurve f2mCurve = (F2mCurve) c; // if (f2mCurve.IsKoblitz) // { // return P.Multiply(a).Add(Q.Multiply(b)); // } // } return(ImplShamirsTrick(P, a, Q, b)); }
public static ECPoint ImportPoint(ECCurve c, ECPoint p) { ECCurve cp = p.Curve; if (!c.Equals(cp)) throw new ArgumentException("Point must be on the same curve"); return c.ImportPoint(p); }