/// <summary> /// Checks if <c>this</c> is irreducible, according to IEEE P1363, A.5.5, p103. /// <para>Note: The algorithm from IEEE P1363, A5.5 can be used to check a polynomial with coefficients in GF(2^r) for irreducibility. /// As this class only represents polynomials with coefficients in GF(2), the algorithm is adapted to the case r=1.</para> /// </summary> /// /// <returns>Returns true if <c>this</c> is irreducible</returns> public bool IsIrreducible() { if (IsZero()) return false; GF2Polynomial f = new GF2Polynomial(this); int d, i; GF2Polynomial u, g; GF2Polynomial dummy; f.ReduceN(); d = f._length - 1; u = new GF2Polynomial(f._length, "X"); for (i = 1; i <= (d >> 1); i++) { u.SquareThisPreCalc(); u = u.Remainder(f); dummy = u.Add(new GF2Polynomial(32, "X")); if (!dummy.IsZero()) { g = f.Gcd(dummy); if (!g.IsOne()) return false; } else { return false; } } return true; }