use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECFieldF2mTest method testEqualsObject05.
/**
* Test #5 for <code>equals()</code> method.<br>
*
* Assertion: objects equal if their m, and rp are mutually equal.
*/
public final void testEqualsObject05() {
ECFieldF2m f1 = new ECFieldF2m(2000);
ECFieldF2m f2 = new ECFieldF2m(2000, BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(981).setBit(2000));
assertFalse(f1.equals(f2) || f2.equals(f1));
}
use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECFieldF2mTest method testEqualsObject04.
/**
* Test #4 for <code>equals()</code> method.<br>
*
* Assertion: pentanomial basis - objects equal if their m, and rp
* are mutually equal.
*/
public final void testEqualsObject04() {
ECFieldF2m f1 = new ECFieldF2m(2000, new int[] { 981, 2, 1 });
ECFieldF2m f2 = new ECFieldF2m(2000, BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(981).setBit(2000));
assertTrue(f1.equals(f2) && f2.equals(f1));
}
use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECFieldF2mTest method testHashCode01.
/**
* Test #1 for <code>hashCode()</code> method.<br>
*
* Assertion: must return the same value if invoked
* repeatedly on the same object.
*/
public final void testHashCode01() {
ECFieldF2m f = new ECFieldF2m(2000);
int hc = f.hashCode();
assertTrue(hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode() && hc == f.hashCode());
}
use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECFieldF2mTest method testIsStatePreserved02.
/**
* Tests that object state is preserved against
* modifications through array reference returned by
* <code>getMidTermsOfReductionPolynomial()</code> method.
*/
public final void testIsStatePreserved02() {
// reference array
int[] a = new int[] { 981, 2, 1 };
// reference array copy
int[] aCopy = a.clone();
// create obj using copy
ECFieldF2m f = new ECFieldF2m(2000, aCopy);
// get array reference and modify returned array
f.getMidTermsOfReductionPolynomial()[0] = 1532;
// compare reference with returned for the second time array
assertTrue(Arrays.equals(a, f.getMidTermsOfReductionPolynomial()));
}
use of java.security.spec.ECFieldF2m in project j2objc by google.
the class ECFieldF2mTest method testGetReductionPolynomial01.
/**
* Test #1 for <code>getReductionPolynomial()</code> method.<br>
*
* Assertion: returns reduction polynomial
*/
public final void testGetReductionPolynomial01() {
BigInteger rp = BigInteger.valueOf(0L).setBit(0).setBit(1).setBit(2).setBit(981).setBit(2000);
assertTrue(new ECFieldF2m(2000, rp).getReductionPolynomial().equals(rp));
}
Aggregations