public virtual bool Equals( F2mFieldElement other) { return((this.m == other.m) && (this.representation == other.representation) && Arrays.AreEqual(this.ks, other.ks) && (this.x.Equals(other.x))); }
public override ECFieldElement Add( ECFieldElement b) { // No check performed here for performance reasons. Instead the // elements involved are checked in ECPoint.F2m // checkFieldElements(this, b); LongArray iarrClone = this.x.Copy(); F2mFieldElement bF2m = (F2mFieldElement)b; iarrClone.AddShiftedByWords(bF2m.x, 0); return(new F2mFieldElement(m, ks, iarrClone)); }
public override bool Equals( object obj) { if (obj == this) { return(true); } F2mFieldElement other = obj as F2mFieldElement; if (other == null) { return(false); } return(Equals(other)); }
/** * Checks, if the ECFieldElements <code>a</code> and <code>b</code> * are elements of the same field <code>F<sub>2<sup>m</sup></sub></code> * (having the same representation). * @param a field element. * @param b field element to be compared. * @throws ArgumentException if <code>a</code> and <code>b</code> * are not elements of the same field * <code>F<sub>2<sup>m</sup></sub></code> (having the same * representation). */ public static void CheckFieldElements( ECFieldElement a, ECFieldElement b) { if (!(a is F2mFieldElement) || !(b is F2mFieldElement)) { throw new ArgumentException("Field elements are not " + "both instances of F2mFieldElement"); } F2mFieldElement aF2m = (F2mFieldElement)a; F2mFieldElement bF2m = (F2mFieldElement)b; if (aF2m.representation != bF2m.representation) { // Should never occur throw new ArgumentException("One of the F2m field elements has incorrect representation"); } if ((aF2m.m != bF2m.m) || !Arrays.AreEqual(aF2m.ks, bF2m.ks)) { throw new ArgumentException("Field elements are not elements of the same field F2m"); } }