FieldElementF2m extends FieldElement implements Serializable { @Override public FieldElement add(FieldElement f) { BigInteger tmp = this.getData().xor(f.getData()); return new FieldElementF2m(tmp, this.getModulus()); } FieldElementF2m(BigInteger data, BigInteger modulus); private  FieldElementF2m(); @Override FieldElement add(FieldElement f); @Override FieldElement mult(FieldElement f); @Override FieldElement addInv(); @Override FieldElement multInv();  }
@Test public void testAdd() { FieldElementF2m tmp = (FieldElementF2m) p1.add(p2); FieldElementF2m result = new FieldElementF2m(new BigInteger("10", 2), modulus); assertEquals(result, tmp); }
@Test public void testEquals() { assertNotEquals(p1, p2); assertEquals(p1, p1); BigInteger p1Data = p1.getData(); FieldElementF2m p1_ = new FieldElementF2m(p1Data, modulus); assertEquals(p1, p1_); p1_ = new FieldElementF2m(p1Data, modulus.add(BigInteger.ONE)); assertNotEquals(p1, p1_); p1_ = new FieldElementF2m(p1Data.add(BigInteger.ONE), modulus); assertNotEquals(p1, p1_); p1_ = new FieldElementF2m(p1Data.add(BigInteger.ONE), modulus.add(BigInteger.ONE)); assertNotEquals(p1, p1_); }