/** * Returns whether the rightmost bit of the bit representation is set. This * is needed for data conversion according to 1363. * * @return true if the rightmost bit of this element is set */ public boolean testRightmostBit() { return polynomial.testBit(0); }
/** * Checks whether the indexed bit of the bit representation is set. * * @param index the index of the bit to test * @return <tt>true</tt> if the indexed bit is set */ boolean testBit(int index) { return polynomial.testBit(index); }
/** * Returns whether the rightmost bit of the bit representation is set. This * is needed for data conversion according to 1363. * * @return true if the rightmost bit of this element is set */ public boolean testRightmostBit() { return polynomial.testBit(0); }
/** * Checks whether the indexed bit of the bit representation is set. * * @param index the index of the bit to test * @return <tt>true</tt> if the indexed bit is set */ boolean testBit(int index) { return polynomial.testBit(index); }
for (int j = 1; j < fieldPolynomial.getLength() - 1; j++) if (fieldPolynomial.testBit(j))
for (int j = 1; j < fieldPolynomial.getLength() - 1; j++) if (fieldPolynomial.testBit(j))
if (d[mDegree - (i << 1)].testBit(mDegree - j))
if (d[mDegree - (i << 1)].testBit(mDegree - j))
/** * Reduce this GF2nPolynomialElement using the trinomial x^n + x^tc + 1 as * fieldpolynomial. The coefficients are reduced bit by bit. */ private void reduceTrinomialBitwise(int tc) { int i; int k = mDegree - tc; for (i = polynomial.getLength() - 1; i >= mDegree; i--) { if (polynomial.testBit(i)) { polynomial.xorBit(i); polynomial.xorBit(i - k); polynomial.xorBit(i - mDegree); } } polynomial.reduceN(); polynomial.expandN(mDegree); }
/** * Reduce this GF2nPolynomialElement using the trinomial x^n + x^tc + 1 as * fieldpolynomial. The coefficients are reduced bit by bit. */ private void reduceTrinomialBitwise(int tc) { int i; int k = mDegree - tc; for (i = polynomial.getLength() - 1; i >= mDegree; i--) { if (polynomial.testBit(i)) { polynomial.xorBit(i); polynomial.xorBit(i - k); polynomial.xorBit(i - mDegree); } } polynomial.reduceN(); polynomial.expandN(mDegree); }
/** * Reduce this GF2nPolynomialElement using the pentanomial x^n + x^pc[2] + * x^pc[1] + x^pc[0] + 1 as fieldpolynomial. The coefficients are reduced * bit by bit. */ private void reducePentanomialBitwise(int[] pc) { int i; int k = mDegree - pc[2]; int l = mDegree - pc[1]; int m = mDegree - pc[0]; for (i = polynomial.getLength() - 1; i >= mDegree; i--) { if (polynomial.testBit(i)) { polynomial.xorBit(i); polynomial.xorBit(i - k); polynomial.xorBit(i - l); polynomial.xorBit(i - m); polynomial.xorBit(i - mDegree); } } polynomial.reduceN(); polynomial.expandN(mDegree); }
/** * Reduce this GF2nPolynomialElement using the pentanomial x^n + x^pc[2] + * x^pc[1] + x^pc[0] + 1 as fieldpolynomial. The coefficients are reduced * bit by bit. */ private void reducePentanomialBitwise(int[] pc) { int i; int k = mDegree - pc[2]; int l = mDegree - pc[1]; int m = mDegree - pc[0]; for (i = polynomial.getLength() - 1; i >= mDegree; i--) { if (polynomial.testBit(i)) { polynomial.xorBit(i); polynomial.xorBit(i - k); polynomial.xorBit(i - l); polynomial.xorBit(i - m); polynomial.xorBit(i - mDegree); } } polynomial.reduceN(); polynomial.expandN(mDegree); }