1
$\begingroup$

My goal is to generate an irreducible polynomial over $GF(2^{12})$ with degree $t$, which can get fairly big, let's say up to $t=200$ or so. I've found this very helpful paper that walks me through the Ben-Or irreducibility test. I've implemented it, and it works perfectly for, um, $t\le5$.

Part of the algorithm requires computing $x^{q^i}-x \bmod f$, where $f$ is a randomly-generated degree $t$ polynomial, the order $q=2^{12}$, and $i$ gets as high as $\frac{t}{2}$. I have a decently efficient adaptation of long division to compute the modulus. Unfortunately I'm using a polynomial library (JLinAlg, for Java) where the degree is represented as a 32-bit signed integer: $2^{q^i}$ is too large for $i>2$.

One option, of course, would be to re-implement polynomials to represent the degree with an arbitrarily large number. But I wonder, since I'm working in a field with characteristic $p=2$ and my dividend is so specific, if there's a better solution that doesn't require the big numbers at all?

$\endgroup$
6
  • 7
    $\begingroup$ There is a standard trick where you reduce the intermediate values in raising x to the q^i and so avoid ever having polynomials of higher degree than that of f. $\endgroup$ Commented Feb 13, 2018 at 20:47
  • $\begingroup$ @WatsonLadd Thank you - could you elaborate? $\endgroup$
    – jecado
    Commented Feb 13, 2018 at 21:07
  • 1
    $\begingroup$ Wikipedia explains it for integer modular arithmetic: en.wikipedia.org/wiki/… $\endgroup$ Commented Feb 13, 2018 at 21:19
  • $\begingroup$ I understand reducing by your modulus at each step in the algorithm - but my problem is that my starting point is so high, $g(x)=x^{(2^{12i})}-x$. I'm not sure which intermediate values @WatsonLadd is referring to. $\endgroup$
    – jecado
    Commented Feb 13, 2018 at 23:10
  • 4
    $\begingroup$ You can compute $x^{2^n}$ mod $f$ by starting with $x$, and then repeatedly squaring and reducing modulo $f$ in each step. Takes you $n$ steps, and the degree of none of the intermediate values gets larger than twice the degree of $f$. $\endgroup$ Commented Feb 14, 2018 at 0:07

1 Answer 1

2
$\begingroup$

OP here. Achim Krause gave the answer in his comment on my question; I'm putting it here to show the question is resolved.

You can compute $x^{2^n} \bmod f$ by starting with $x$, and then repeatedly squaring and reducing modulo $f$ in each step. Takes you $n$ steps, and the degree of none of the intermediate values gets larger than twice the degree of $f$.

Now you have $x^{2^n} \bmod f$, and you simply subtract $x$ to get the desired $x^{2^n}-x \bmod f$. You don't even need an extra modulus step, since subtracting $x$ doesn't affect the degree of your result.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .