protected internal ECPoint( ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) { if (curve == null) throw new ArgumentNullException("curve"); this.curve = curve; this.x = x; this.y = y; this.withCompression = withCompression; }
public static int GetByteLength( ECFieldElement fe) { return (fe.FieldSize + 7) / 8; }
protected bool Equals( ECFieldElement other) { return ToBigInteger().Equals(other.ToBigInteger()); }
public abstract ECFieldElement Divide(ECFieldElement b);
public abstract ECFieldElement Multiply(ECFieldElement b);
public abstract ECFieldElement Subtract(ECFieldElement b);
public abstract ECFieldElement Add(ECFieldElement b);
public override ECFieldElement Divide( ECFieldElement b) { return new FpFieldElement(q, x.Multiply(b.ToBigInteger().ModInverse(q)).Mod(q)); }
public override ECFieldElement Subtract( ECFieldElement b) { return new FpFieldElement(q, x.Subtract(b.ToBigInteger()).Mod(q)); }
public override ECFieldElement Add( ECFieldElement b) { return new FpFieldElement(q, x.Add(b.ToBigInteger()).Mod(q)); }
/** * Create a point that encodes with or without point compresion. * * @param curve the curve to use * @param x affine x co-ordinate * @param y affine y co-ordinate * @param withCompression if true encode with point compression */ public FpPoint( ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) : base(curve, x, y, withCompression) { if ((x != null && y == null) || (x == null && y != null)) throw new ArgumentException("Exactly one of the field elements is null"); }
/** * Create a point which encodes with point compression. * * @param curve the curve to use * @param x affine x co-ordinate * @param y affine y co-ordinate */ public FpPoint( ECCurve curve, ECFieldElement x, ECFieldElement y) : this(curve, x, y, false) { }
protected internal ECPointBase( ECCurve curve, ECFieldElement x, ECFieldElement y, bool withCompression) : base(curve, x, y, withCompression) { }