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)); }
internal static ECPoint ImplShamirsTrickJsf(ECPoint P, BigInteger k, ECPoint Q, BigInteger l) { ECCurve curve = P.Curve; ECPoint infinity = curve.Infinity; ECPoint eCPoint = P.Add(Q); ECPoint eCPoint2 = P.Subtract(Q); ECPoint[] array = new ECPoint[] { Q, eCPoint2, P, eCPoint }; curve.NormalizeAll(array); ECPoint[] array2 = new ECPoint[] { array[3].Negate(), array[2].Negate(), array[1].Negate(), array[0].Negate(), infinity, array[0], array[1], array[2], array[3] }; byte[] array3 = WNafUtilities.GenerateJsf(k, l); ECPoint eCPoint3 = infinity; int num = array3.Length; while (--num >= 0) { int num2 = (int)array3[num]; int num3 = num2 << 24 >> 28; int num4 = num2 << 28 >> 28; int num5 = 4 + num3 * 3 + num4; eCPoint3 = eCPoint3.TwicePlus(array2[num5]); } return(eCPoint3); }
internal static ECPoint ImplShamirsTrickJsf(ECPoint P, BigInteger k, ECPoint Q, BigInteger l) { ECCurve curve = P.Curve; ECPoint infinity = curve.Infinity; // TODO conjugate co-Z addition (ZADDC) can return both of these ECPoint PaddQ = P.Add(Q); ECPoint PsubQ = P.Subtract(Q); ECPoint[] points = new ECPoint[] { Q, PsubQ, P, PaddQ }; curve.NormalizeAll(points); ECPoint[] table = new ECPoint[] { points[3].Negate(), points[2].Negate(), points[1].Negate(), points[0].Negate(), infinity, points[0], points[1], points[2], points[3] }; byte[] jsf = WNafUtilities.GenerateJsf(k, l); ECPoint R = infinity; int i = jsf.Length; while (--i >= 0) { int jsfi = jsf[i]; // NOTE: The shifting ensures the sign is extended correctly int kDigit = ((jsfi << 24) >> 28), lDigit = ((jsfi << 28) >> 28); int index = 4 + (kDigit * 3) + lDigit; R = R.TwicePlus(table[index]); } return(R); }
internal static ECPoint ImplShamirsTrickJsf(ECPoint P, BigInteger k, ECPoint Q, BigInteger l) { ECCurve curve = P.Curve; ECPoint infinity = curve.Infinity; ECPoint point2 = P.Add(Q); ECPoint point3 = P.Subtract(Q); ECPoint[] points = new ECPoint[] { Q, point3, P, point2 }; curve.NormalizeAll(points); ECPoint[] pointArray2 = new ECPoint[] { points[3].Negate(), points[2].Negate(), points[1].Negate(), points[0].Negate(), infinity, points[0], points[1], points[2], points[3] }; byte[] buffer = WNafUtilities.GenerateJsf(k, l); ECPoint point4 = infinity; int length = buffer.Length; while (--length >= 0) { int num2 = buffer[length]; int num3 = (num2 << 0x18) >> 0x1c; int num4 = (num2 << 0x1c) >> 0x1c; int index = (4 + (num3 * 3)) + num4; point4 = point4.TwicePlus(pointArray2[index]); } return(point4); }