/// <summary> /// 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. /// </summary> 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.Length - 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); }