Tests and Constructions of Irreducible Polynomials Over Finite Fields
Total Page:16
File Type:pdf, Size:1020Kb
Tests and Constructions of Irreducible Polynomials over Finite Fields 1 2 Shuhong Gao and Daniel Panario 1 Department of Mathematical Sciences, Clemson University, Clemson, South Carolina 29634-1907, USA E-mail: [email protected] 2 Department of Computer Science, UniversityofToronto, Toronto, Canada M5S-1A4 E-mail: [email protected] Abstract. In this pap er we fo cus on tests and constructions of irre- ducible p olynomials over nite elds. We revisit Rabin's 1980 algo- rithm providing a variant of it that improves Rabin's cost estimate by a log n factor. We give a precise analysis of the probability that a ran- dom p olynomial of degree n contains no irreducible factors of degree less than O log n. This probability is naturally related to Ben-Or's 1981 algorithm for testing irreducibility of p olynomials over nite elds. We also compute the probability of a p olynomial b eing irreducible when it has no irreducible factors of low degree. This probability is useful in the analysis of various algorithms for factoring p olynomials over nite elds. We present an exp erimental comparison of these irreducibility metho ds when testing random p olynomials. 1 Motivation and results For a prime power q and an integer n 2, let IF be a nite eld with q q n elements, and IF be its extension of degree n. Extensions of nite elds are q imp ortant in implementing cryptosystems and error correcting co des. One way of constructing extensions of nite elds is via an irreducible p olynomial over the ground eld with degree equal to the degree of the extension. Therefore, nding irreducible p olynomials and testing the irreducibility of p olynomials are fundamental problems in nite elds. A probabilistic algorithm for nding irreducible p olynomials that works well in practice is presented in [26]. The central idea is to take p olynomials at random and test them for irreducibility. Let I b e the numb er of irreducible p olynomials n of degree n over a nite eld IF .Itiswell-known see [21], p. 142, Ex. 3.26 & q 3.27 that n=2 n n q q 1 q q q I : 1 n n q 1n n This means that a fraction 1=n of the p olynomials of degree n are irreducible, and so we nd on average one irreducible p olynomial of degree n after n tries. In order to transform this idea into an algorithm one has to consider irreducibility tests. In sections 2 and 3, we fo cus on tests for irreducibility. Let f 2 IF [x], deg f = n, q be a p olynomial to b e tested for irreducibility. Assume that p ;:::;p are the 1 k distinct prime divisors of n. In practice, there are two general approaches for this problem: { Butler 1954: f is irreducible if and only if dim ker I = 1, where is the q Frob enius map on IF [x]=f that sends h 2 IF [x]=f to h 2 IF [x]=f , q q q and I is the identity map on IF [x]=f see [4]; q n=p i q x = 1 for all { Rabin 1980: f is irreducible if and only if gcdf; x n q 1 i k , and x x 0mod f see [26]. Other irreducibility tests can b e found in [14], [31], and [12]. In this pap er, we concentrate on Rabin's test, and a variant presented in [1]. In section 2, we review Rabin's and Ben-Or's irreducibility algorithms. We state a variant of Rabin's algorithm that allows a log n factor saving. In section 3, we fo cus on Ben-Or's algorithm. This leads us to study the b ehavior of rough p olynomials, i.e., p olynomials without irreducible factors of low degrees. The analysis is expressed as an asymptotic form in n, the degree of the p olynomial to b e tested for irreducibility. First, we x a nite eld IF , and then we study q asymptotics on q . As was noted in [7], probabilistic prop erties of p olynomials over nite elds frequently have a shap e that resembles corresp onding prop er- ties of the cycle decomp osition of p ermutations to which they reduce when the size of the eld go es to in nity. An instance of this is derived for the proba- bility that a p olynomial of degree n over IF contains no factors of degree m, q 1 m O log n, when q ! +1. This probability relates naturally with Ben- Or's algorithm. The probability of a p olynomial b eing irreducible when it has no irreducible factors of low degree provides useful information for factoring p oly- nomials over nite elds see for instance [12], x6. We provide the probability of a p olynomial b eing irreducible when it has no irreducible factors of degree at most O log n. In section 4, we give an exp erimental comparison on the algorithms discussed in section 2. We provide tables of running times of the algorithms for various elds and p olynomial degrees. These results suggest that Ben-Or's algorithm has a much b etter average time b ehavior than others, even though its worst-case complexity is the worst. Very sparse irreducible p olynomials are useful for several applications: pseu- dorandom numb er generators using feedback shift registers [15], discrete loga- n rithm over IF [6], [23], and ecient arithmetic in nite elds Shoup private 2 communication, 1994. However, few results are known ab out these p olynomials beyond binomials and trinomials see [22], Chapter 3, and the references there. In section 5, we present a construction of irreducible p olynomials over IF of q degree n with up to O 1 nonzero terms not necessarily the lowest co ecients, for in nitely many degrees n. We assume that arithmetic in IF is given. The cost measure of an algorithm q will b e the numb er of op erations in IF . The algorithms in this pap er use basic q p olynomial op erations like pro ducts and gcds. We consider in this pap er exclu- sively FFT based arithmetic; similar results hold for classical arithmetic. Let 2 M n = n log n log log n. For constants and , the cost of multiplying two 1 2 p olynomials of degree at most n using \fast" arithmetic [28], [27], [5] can b e taken as M n, and the cost of a gcd b etween two p olynomials of degree at 1 most n can b e taken as log nM n op erations in IF . The numberofmultipli- 2 q q cations needed to compute h mo d f by means of the classical repeated squaring metho d see [20], p. 441{442, where h is a p olynomial over IF of degree less q than n, is C = blog q c + q , with q the number of ones in the binary q 2 q representation of q . Therefore, the cost of computing h mo d f by this metho d is C M n op erations in IF using FFT based metho ds. 1 q q 2 Irreducibility tests In this section, we review Rabin's and Ben-Or's tests, and we presentavariant of Rabin's metho d. 2.1 Rabin irreducibility test and an improvement Algorithm: Rabin IrreducibilityTest Input: A monic p olynomial f 2 IF [x] of degree n, q and p ;:::;p all the distinct prime divisors of n . 1 k Output: Either \f is irreducible" or \f is reducible". for j := 1 to k do n := n=p ; j j for i := 1 to k do n i q g := gcdf , x x mod f ; if g 6=1, then `f is reducible' and STOP; endfor; n q g := x x mod f ; if g =0, then `f is irreducible' else `f is reducible'; The correctness of Rabin's algorithm is based on the following fact see [26], p. 275, Lemma 1. Fact 2.1 Let p ;:::;p be al l the prime divisors of n, and denote n=p = n , 1 k i i for 1 i k .Apolynomial f 2 IF [x] of degree n is irreducible in IF [x] if and q q n n i q q only if gcdf; x x mod f =1, for 1 i k , and f divides x x. n i q The basic idea of this algorithm is to compute x mo d f indep endently for each value n ;:::;n by rep eated squaring, and then to take the corresp ondent gcd. 1 k The worst-case analysis given in [26]isOnM n log n log q op erations in IF . q However, it can b e shown that O nM n log log n log q is an upp er b ound of the 3 numb er of op erations in IF for this algorithm. Indeed, rst note that the number q of distinct prime factors of n is at most log n. The cost of k exp onentiations is log n k X X n 1 log qMn nM n log q nM n log qH ; log n p p i i i=1 i=1 P m 1=k is the harmonic sum. Using the well-known approxima- where H = m k =1 1 tion of the harmonic sum [16], p. 452, H = log log n + + O , we obtain log n log n 2 O nM n log log n log q , which dominates the cost O M n log n of computing k gcd's.