UNIVERSITÀ DEGLI STUDI ROMA TRE FACOLTÀ DI S.M.F.N.
Graduation Thesis in Mathematics by Silvia Pastore
Normal bases in finite fields and Efficient Compact Subgroup Trace Representation
Supervisor Prof. Francesco Pappalardi
The Candidate The Supervisor
ACADEMIC YEAR 2006 - 2007
Classification: 94A60 11T71 11Y16 Key Words: XTR, Normal Basis, Optimal Normal Basis. A te che meritavi tanto, A te, Nico.
1 Contents
Introduction ...... 3
1 Background 14 1.1 Algebraic structures ...... 14 1.2 Normal bases ...... 15 1.2.1 The multiplication matrix ...... 19 1.3 Construction of the optimal normal bases ...... 25
2 Arithmetic operations in 30 Fp2
3 XTR supergroup and XTR subgroup 35 3.1 Traces ...... 35 3.2 The polynomials F (c, X) ...... 37 3.3 Properties of F (c, X) and its roots ...... 38
3.4 The computation of cn ...... 43
4 XTR parameter and key selection 48 4.1 Selection of p and q ...... 48 4.2 Selection of the subgroup ...... 50
5 Cryptographic applications 53 5.1 XTR - Diffie Hellman and XTR - ElGamal ...... 53 5.2 Discrete logarithm ...... 58
A Karatsuba Algorithm 64 A.1 Karatsuba's algorithm ...... 65
2 B Multi-exponentiation algorithm 68 References ...... 72
3 Introduction
In the last twenty years, with the development of coding theory and appearance of several cryptosystems, the study of nite elds has generated much interest. This impetus behind this interest has been the need to produce efficient algorithms that can be implemented in the hardware or software used for applications such as data encryption and public key distribution. The necessity to produce efficient algorithms is translated into solving mathematical problems involving computations in nite elds. From many years, normal bases have been used to represent nite elds and the advantages of this choice are been shown. Hensel (1888) pioneered the study of normal bases for nite elds and proved that they always exist. Eisenstein (1850) had already noted that normal bases always exist. Hensel, and also Ore (1934), determine exactly the number of these bases. In particular, in this thesis, we will show that the complexity of several hardware or software implementations, based on multiplication schemes, de- pends on the choice of the normal bases used. Hence is essential to nd normal basis with low complexity. So we are interested in nding a lower bound for this complexity and we will present a costruction of a normal basis with this complexity. Such a normal basis is called optimal normal basis. We will analyse the effects of optimal normal bases on computations in nite elds, in particular on the nite eld . Fp2 We will also describe how, using optimal normal basis, the computations in can be done efficently. In particular we will obtain that th powers in Fp2 p does not require any arithmetic operations. Fp2 This last result, with others obtained in , are at the base of a new Fp2 method that use arithmetic in , the so-called XTR. Fp2
4 XTR was introduced at Crypto 2000 [9] by Arjen K. Lenstra and Eric R. Verheul, it stands for ECSTR, which is an abbreviation for Ecient and Compact Subgroup Trace Representation. XTR is a new method to represent elements of a subgroup of a multi- plicative group of a nite eld. XTR is based on the same idea introduced by Shannon that is to replace a generator of the full multiplicative group of a nite eld by the generator of a relatively small subgroup of sufficiently large prime order q. XTR, infact, uses a subgroup of prime order q of the order p2 − p + 1 subgroup of ∗ . Fp6 The cyclic group ∗ has order 6 , therefore only a cyclic subgroup Fp6 p − 1 with order p2 − p + 1 exists. We will refer to this last group as the XTR supergroup X, while to the order q subgroup, with q dividing p2 − p + 1, as the XTR subgroup Y= hgi. We will show how XTR uses the trace over to represent and calculate Fp2 powers of elements of the XTR subgroup. In fact, the arbitrary powers of an element of g can be represented using a single element of the subeld and such powers can be computed eciently Fp2 using arithmetic operations in while avoiding arithmetic in . Fp2 Fp6 This last result is useful for cryptographic purposes if there is a way to ecently compute T r(gn) given T r(g). So we will nd an algorithm that not only solves our last problem, but is also three times faster than computing gn given g. Naturally, we will have to choose appropriate parameters p and q to obtain an optimal normal basis and such that the XTR subgroup Y, with order q, cannot be embedded in the multiplicative group of any true subfield of . Fp6 Given , we will nd for an element of order p, q > 3 T r(g) ∈ Fp2 g ∈ Fp6 q, through different methods. From a security point of view, XTR is a traditional system based on the diculty of solving discrete logarithm problems in the multiplicative group of a nite eld.
5 Therefore XTR can be used in any cryptosystem that relies on the sub- group discrete logarithm problem. To illustrate this, we will present the XTR version of the Diffie Hellman key agreement protocol and ElGamal encryp- tion and decryption protocols. These versions follow by replacing the ordinary representation of subgroup elements with the XTR representation of subgroup elements of a multiplica- tive group that, as we have seen before, consists in replacing XTR group elements by their trace. We will also see that, through this representation, the computation of Diffie Hellman Key agreement protocol and ElGamal encryption and de- cryption protocols becomes three times faster than computing gn given g, as in their traditional versions. We know that the traditional versions base their security on the diculty to solve the discrete logarithm problem. We will show that there is, also, the XTR discrete logarithm problem version on wich the security of XTR - Diffie Hellman and XTR - ElGamal protocols is based. Moreover as Diffie Hellman problem and Diffie Hellman Decision prob- lem are related to the Discrete Logarithm problem as, their XTR version, the XTR - Diffie Hellman problem and XTR - Diffie Hellman Decision problem, are related to XTR - Discrete Logarithm problem. There are, also, some equivalences between old a new problems. We will use these equivalences to prove that DL problem in XTR subgroup Y is as hard as . Fp6 Because of the facts above, we can conclude that application of XTR in cryptographic protocols leads to the advantages in comunication and com- putational overhead without compromising security. Our work is organized in the following way.
In the Chapter 1 we present some necessary denitions and properties. In particular it is necessary to dene nite elds, Frobenius automorsm, cyclotomic elds, cyclotomic polynomials and roots of unity, all in the context
6 in which they will be used in this thesis. It is presented a proof that shows that a normal basis exists for every nite extension of a nite eld. The existence of a normal basis allows for particularly simple multiplications of the elements of the eld. In fact, we show as it is possible to compute the multiplication between two elements in , with respect to a normal bases p pn−1 , Fpn N = {α, α , ... , α } using -matrix with entries in , dened by: n × n TN = (ti,k)0≤i,k pi X pk α · α = ti,kα for 0 ≤ i < n 0≤k (k) ti,j = ti−j,k−j is set one correspondence between the matrix T0 and the matrix TN . Therefore we use the matrix TN to compute the multiplication between A and B. This matrix is advantageous not only for the memory of the calculator saving, but also from computational costs point of view. We see that these costs depend by dN, the number of non-zero entries in TN. Thus we dene as dN the complexity of normal basis N, along with a proof that shows the lower bound for the complexity of any normal basis. A particular type of normal basis, whose complexity value achieves the lower bound, is called optimal normal basis. Then, by this last basis, we obtain, also, a lower bound for the computational cost. To construct the optimal normal basis, we prove the result: Theorem 1.5 (Optimal normal bases, see [14]) Let n + 1 be a prime and be a primitive root modulo (i.e. modulo generates ∗ ). Let p n+1 p n+1 Fn+1 ς 7 be a primitive -th root of unity in an extension eld of and . (n + 1) Fp α = ς Then p p2 pn−1 is an optimal normal basis of over . N = {α, α , α , ... , α } Fpn Fp Then knowing the conditions for which an optimal normal basis exists, we obtain, also, the semplication of the process of selecting nite elds for specic applications. In Chapter 2 we deal with the mathematic of XTR. To this purpose, at rst we present a representation of and then we Fp2 describe how the computations in can be done efficiently. Fp2 So we set p ≡ 2 (mod 3). Hence X2 + X + 1 is an irriducible polynomial over . We represent as: Fp Fp2 ∼ p 2 Fp2 = x1α + x2α : α + α + 1 = 0 , x1, x2 ∈ Fp where {α, αp} are the zeros of the polynomial X2+X+1 and form an optimal normal basis for over , since and is a primitive root Fp2 Fp p ≡ 2 (mod 3) p modulo , i.e. generates ∗. 3 p (mod 3) F3 Considering the elements , we see as it is possible to compute x, y, z ∈ Fp2 efficently p 2 and p in . For comparison purposes, we x , x , x · y x · z − y · z Fp compute the same relation in the case . x, y, z ∈ Fp6 These results follow, also, by the use of Karatsuba's trick and multi- exponentation algorithm, described in the appendices. In Chapter we present the denition of the trace over we show that 3 Fp2 it is -linear. We show that the trace of the element ∗ of order that Fp2 g ∈ Fp6 q divides p2 − p + 1 is equal to the trace of its conjugates. Set a prime and set for be the polynomial 3 2 p F (c, X) c ∈ Fp2 X − cX + p ; for we denote by the sum of the th powers of c X − 1 ∈ Fp2 [X] n ∈ Z cn n the roots of F (c, X) and so we prove the following result: Theorem 3.1. The roots of X3 − T r(g)X2 + T r(g)pX − 1 are the conjugates of g. Then the minimal polynomial of any of order dividing 2 g ∈ Fp6 p − p + 1 8 and > 3 is equal to F (T r(g),X). Hence the fundamental idea of XTR is, as illustrated, that the trace value fully specifies g's minimal polynomial and thus the conjugates of g. In a similar way we illustrate that this last result is true for any power of n. In fact, for any integer n, the conjugates of gn are the roots of X3 − n 2 n p and the latter polynomial and the conjugates T r(g )X +T r(g ) X −1 ∈ Fp2 of n are determined by n . g T r(g ) ∈ Fp2 Vice versa we show that if is irreducible, then the roots F (c, X) ∈ Fp2 [X] of take the form p2 p4 for some of order dividing 2 F (c, X) h, h , h h ∈ Fp6 p −p+1 and > 3. This implies one of the property of , i.e. it is of the form n . cn T r(h ) ∈ Fp2 Another result that we obtain on over is the theorem: F (c, X) Fp2 Theorem 3.3 is reducible over if and only if . F (c, X) Fp2 cp+1 ∈ Fp Then, let with order for a prime dividing 2 , g ∈ Fp6 q q > 3 p − p + 1 n n it follows from the results cited above that F (T r(g ), g ) = 0 and cn = n . T r(g ) ∈ Fp2 These results are useful for cryptographic purpose if, as we have said above, there is a way to efficiently compute T r(gn) given T r(g). To this goal we describe an Algorithm that computes for any and such that is cn n ∈ Z three times faster than the algorithm that computes gn given g. The efficiency of this algorithm it is based on properties of cn that have been illustrated in this chapter. In Chapter 4 we describe fast and pratical methods that satisfy these two conditions: 1. p and n + 1 are prime numbers and p is a primitive root (mod n + 1). 2 2. Φ6(p) = p − p + 1 has a prime factor q. By these conditions we obtain that has an optimal normal basis and Fp2 that the XTR subgroup Y, with the order q, cannot be embedded in the multiplicative group of any proper subeld of . Fp6 9 So the primes p and q of appropriate sizes can be found using both the methods that we present in this thesis. In particular through the rst one, we nd a prime p that satises a second degree polynomial with small coefficients. Moreover, for k = 1, the prime p assumes a very nice form. Given and , we must nd for an element of p q > 3 T r(g) ∈ Fp2 g ∈ Fp6 order q. We show that to nd a proper it suffices to nd such T r(g) c ∈ Fp2 \ Fp that is irreducible, such that and to put F (c, X) ∈ Fp2 [X] c(p2−p+1)/q 6= 3 T r(g) = c(p2−p+1)/q. To nd such that is irreducible we consider the following c ∈ Fp2 F (c, X) result: Lemma 4.1 For a randomly selected the probability that c ∈ Fp2 F (c, X) ∈ is irreducible is about one third. Fp2 [X] We close the chapter presenting an algorithm that it is based on the above Lemma and on the fact that is reducible if and only if , that F (c, x) cp+1 ∈ Fp is a result of Chapter 3. In the Chapter 5, we deal with the XTR version of the Diffie Hellman key agreement protocol and ElGamal encryption and decryption protocols, since XTR can be used in any cryptosystem that relies on the subgroup discrete logarithm problems. This version is dierent to the traditional, since it is based on the XTR representation of the XTR group elements that consists in replacing the XTR elements with their trace. In these protocols there are two users A and B that already agreed upon XTR subgroup Y and on the XTR public key data (p, q, T r(g)), where the two primes p and q are as in chapter 4, and T r(g) is the trace of an generator of XTR subgroup Y. As is well-know, while in the XTR Diffie Hellman key agreement protocol the two users want to agree on a secret key K, in ElGamal encryption and decryption protocols, we suppose that B wants to encrypt a message M 10 intended for A and that A decrypts the message (T r(gb),E) that he has received by B. For this reason, we suppose that in the key XTR public data of A there is also the value T r(gk) that is computed and made public by A, for an integer k selected by A, that it is kept secret, the so-called private key. Analysing these algorithms, we note that they compute T r(gh), where gh is an element in XTR subgroup with 0 < h < q − 2, using the algorithm described in Chapter 3, to compute T r(gh) given T r(g). For this reason the XTR Diffie Hellman key agreement protocol and XTR ElGamal encryption and decryption protocols are three times faster than their traditional versions. Moreover these last versions base their security on the diculty to solve the Discrete Logarithm (DL) problem and we show that Diffie Hellman (DH) problem and Diffie Hellman Decision (DHD) problem are related to DL problem. But since the XTR version of the protocols follows by replacing elements of the XTR group by their traces, then the security of these protocols is no longer based on the original DH, DHD or DL problems, but on their XTR versions. If we dene the equivalence between two problem through this result: Denition 5.1 We say that problem A is (a, b)-equivalent to problem B, if any istance of problem A (or B) can be solved by at most a (or b) calls to an algorithm solving problem B (or A). We obtain this fundamental equivalences between old and new problems: Theorem 5.1 The following equivalences hold: i. The XTR-DL problem is (1, 1)-equivalent to the DL problem in G. ii. The XTR-DH problem is (1, 2)-equivalent to the DH problem in G. iii. The XTR-DHD problem is (3, 2)-equivalent to the DHD problem in G. Then thanks to this last result, we prove that DL problem in XTR sub- 11 group Y is as hard as in ∗ . Fp6 In fact we show that the Discrete Logarithm problem in , can be re- Fp6 duced to the discrete logarithm problems in multiplicative groups of proper subelds and of and in the subgroup of order 2 that Fp, Fp2 Fp3 Fp6 p − p + 1 cannot be embedded in any proper subfield of . Fp6 Since the rst three problems are believed to be considerably easier than the problem in ∗ , we conclude that the hardness of computing discrete Fp6 logarithm in the group ∗ must reside in its subgroup of order 2 . Fp6 p − p + 1 From this result, considering the XTR subgroup Y that has order a large prime q that divide p2 − p + 1 and that cannot be embedded into any proper subeld of , we have concluded that the discrete logarithm problem in Y Fp6 is as hard as it is . Fp6 Then the XTR version of the Diffie Hellman key agreement protocol and XTR ElGamal encryption and decryption protocols makes this protocol more fast and secure. At the end of this thesis there are two appendices, in which some of algorithms, used in Chapter 2, are discussed. In Appendix A, we describe the Karatsuba's trick for the multiplication of two polynomials of degree less than n and we show that this trick makes the computational cost of this multiplication lower. In fact, while with the classic multiplication algorithm the number of mul- tiplication is O(n2), with the Karatsuba's trick the number of multiplication it is reduced to O(n1.59). In Appendix B, we deal with the Pekmestzi's algorithm, that is a method to compute the multi-exponentation, i.e. Q ai . Z = 0 12 proves and so it can be used to implement fast modern cryptosystems that have as a major task to obtain an efficient performance. 13 Chapter 1 Background In this chapter we present some basic facts about the algebraic structures that we shall use. In particular we focus our attention on the existence of normal bases over nite elds and in the construction of optimal normal bases in an extension nite eld. We shall debate, also, on the advantages to use normal and optimal normal basis from computational point of view. 1.1 Algebraic structures We report in this section some basic denitions and basic facts of the algebraic structures that are used in this thesis. For details and proofs we refer to book of Lidl & Niederreiter (1983). A nite eld F is a nite ring satisfying the property that (F\{0} , ·) is a commutative group. It is a standard fact that if F is a nite eld containing a subeld K with p elements, then F has pn elements, where n = [F : K] is the degree of extension of F over K. Two nite elds with the same number of elements are isomorphic. Thus we denote nite eld with q = pn elements, or the nite eld of order n by , where the prime is the characteristic of and is the q = p Fq p F n degree of F over its prime subeld. 14 There are dierent ways to represent a nite eld with pn elements, one of these methods is to consider an irreducible polynomial over of degree Fp , , then adjoining a root of to we get nite eld with n n f ∈ Fp[x] α f Fp p elements and (see [10], Theorem 2.14). Fpn = Fp(α) Every element of can be uniquely expressed as a polynomial in over Fpn α , of degree less than (see [10], Theorem 1.86): Fp n = Fp Fq (f) n−1 for and = A0 + ... + An−1α : Ai ∈ Fp i = 0, ..., n − 1 f(α) ≡ 0 1.2 Normal bases The importance of the normal bases is due to the development of coding theory and the implementation of several cryptosystems using nite elds. We see, before, that the advantages of this choice reside in the improvement of the computational cost (see [11]). Denition 1.1. Let be an extension of and let . Then the Fpn Fp α ∈ Fpn elements α, αp, αp2 , ... , αpn−1 are called the conjugates of α with respect to Fp Denition 1.2 (Normal basis, see [10]). Let be an extension of . Fpn Fp Then a basis of over of the form pn−1 consisting of Fpn Fp N = {α, ... , α } the conjugates of a suitable element with respect to , is called a α ∈ Fpn Fp normal basis of over . The element is then called normal in over Fpn Fp α Fpn . Fp Then every may be uniquely expressed in term of as A ∈ Fpn N n−1 p pn−1 X pi A = A0α + A1α + ... + An−1α = Ai · α i=0 15 with coefcients A0,A1, ... , An−1 ∈ Fp EXAMPLE (Normal and not normal elements) Let 3 an irreducible polynomial on , then: f(x) = x + x + 1 F2 = F2 = {a + a α + a α2 : a , a , a ∈ and α3 + α + 1 ≡ 0} F8 (x3 + x + 1) 0 1 2 0 1 2 F2 = {0, 1, α, α2, α + 1, α2 + 1, α2 + α, α2 + α + 1} Note that α is not normal since {α, α2, α4 ≡ α2 + α} is not a base. While α + 1 is normal, since: (α + 1) (mod f) (α + 1)2 = α2 + 1 (mod f) (α + 1)4 = (α2 + 1)2 = α4 + 1 = α2 + α + 1 (mod f) is a basis for over . F2[α] F2 If we compute the conjugates of all the elements of , we obtain that: F8 {0, 1, α, α2, α2 + α} are not normal elements, while {α + 1, α2 + 1, α2 + α} are normal elements. Now we present a proof that shows the existence of a normal basis in a nite eld extension and in the next section we show how the existence of a 16 normal basis allows for particularly simple multiplication of the elements of the eld. For this purpose we recall few useful denitions. Denition 1.3 (Frobenius automorsm, see [11]). Let be an extension Fpn of , then the Frobenius automorphism is a map of over of the form: Fp Fpn Fp p σ : η 7→ η , η ∈ Fpn If we view as a vector space of dimension over then the Frobenius Fpn n Fp map is a linear transformation of over , since σ Fpn Fp σ(α + β) = σ(α) + σ(β) and for all and . σ(c · α) = c · σ(α) α, β ∈ Fpn c ∈ Fp Denition 1.4 (see [11]). Let Γ a linear transformation on a nite-dimensional vector space over a (arbitrary) eld , a polynomial Pn i in V F f(x) = i=0 Aix F [x] is said to annihilate Γ if n n−1 f(Γ) = AnΓ + An−1Γ + ... + Γ0I = 0 where I is the identity map and 0 is the zero map on V . The uniquely determined monic polynomial of least degree that satises the last property is called the minimal polynomial for Γ. In particular this polynomial divides any other polynomial in F [x] annihi- lating Γ and the cheracteristic polynomial for Γ (Cayley-Hamilton theorem). We say that a vector α ∈ V is a cyclic vector for T if the vectors T kα, k = 0, 1, ... span V Lemma 1.1. (see [10]) Let T be a linear operator on the nite-dimensional vector space V . Then T has a cyclic vector if and only if the characteristic and minimal polynomials for T are identical. 17 Remark 1.1. We are not able to prove this last Lemma in the particular case of nite elds. Theorem 1.1 (Normal Basis Theorem, see [10, 11]). For any nite eld Fp and any nite extension of there exists a normal basis of over . Fpn Fp Fpn Fp Proof . We have note before that the Frobenius automorphism σ is a linear operator on . Fpn Thus we know that n pn for every , then n and σ (η) = η = η η ∈ Fpn σ = 1 so σ satses the polynomial xn − 1. We prove that xn − 1 is the minimal polynomial of σ. We suppose that there is a polynomial n−1 X i f(x) = Aix ∈ Fp[x] i=0 of degree less than n that annihilates σ, therefore we have: n−1 X i f(x) = Aiσ = 0 i=0 Then n−1 ! n−1 n−1 X i X i X pi Aiσ (η) = Aiσ (η) = η = 0 i=0 i=0 i=0 for any . η ∈ Fpn Thus η is a root of the polynomial f(x). This is absurd because the degree of the polynomial f(x) is at most pn−1 and so f(x) cannot have pn > pn−1 roots in . Hence n is the minimal polynomial of . Fpn x − 1 σ Moreover the minimal polynomial of σ divides the characteristic polyno- mial of σ (Cayley-Hamilton theorem). But the characteristic polynomial of σ is monic and of degree n then the characteristic polynomial of σ is equal to the minimal polynomial of σ, namely xn − 1. Thus there exists an element such that 2 span α ∈ Fpn α, σ(α), σ (α), ... and form a basis of over (cf. Lemma 1.1). But the elements of Fpn Fpn Fp this basis are and its conjugates with respect to so these elements form α Fp a normal basis of over Fpn Fp 18 1.2.1 The multiplication matrix The crucial point in normal basis arithmetic is multiplication. We rst consider the general multiplication scheme in . Fpn Let be an extension of , let a basis over Fpn Fp B = {α0, α1, ... , αn−1} and let Fp X and X with A = Aiαi B = Bjαj Ai,Bj ∈ Fp 0≤i A = (A0,A1, ... , An−1) and B = (B0,B1, ... , Bn−1) Hence multiplication is: X A · B = AiBjαi · αj 0≤i,j X (k) with (k) (1.1) αi · αj = ti,j αk ti,j ∈ Fp 0≤k X C = A · B = AiBj · αi · αj = 0≤i,j 19 and k is an matrix over . Tk = (ti,j) n × n Fp Thus to implement the multiplication in is necessary to compute Fpn ck for any k = 0, 1, ... , n − 1 and each ck require from computational point of view multiplications in where is the number of nonzero entries dk Fp dk in Tk for any k = 0, 1, ..., n − 1, then to compute C are necessary n · dk multiplications for any and additions in . k = 0, 1, ..., n − 1 (dk − 1) · n Fpn Now we consider a normal basis of over , N = {α0, α1, ... , αn−1} Fpn Fp pi where we have set αi = α . Let P then A = 0≤i p so the coordinate vectors of A are (An−1,A0, ... , An−2), then A is obtained from A by one cyclic shift of the the coordinates of A and can be compute without any operations in . Fp If we now consider the identity (1.1) and we raise both sides of equation to the p−m-th powers one nds that: (m) (0) for any ti,j = ti−m,j−m 0 ≤ i, j, m < n Thus the matrix T0 that we use to compute c0 with the coordinates of A and B is the same matrix that we use to compute cm with the coordinates of Ap−m and Bp−m , but we know that Ap−m as Bp−m are obtain with m-cyclic shift of the vector representations of A and B, then we can compute any ck shifting the A and B vectors. From this property of symmetry of normal basis N it follows that the computational cost of the multiplication between A and B depend to the number of nonzero terms of T0 (see [11]). Now we dene matrix with entries in by: n × n− TN = (ti,k)0≤i,k pi X pk α · α = ti,kα for 0 ≤ i < n 0≤k 20 We shall show how is possible to compute the multiplication between A and B using TN and how the computational cost of their multiplication with this matrix improves. Let X pi X pj A = Ai · α and B = Bj · α 0≤i We can write: !pj pj pi pj pi−j X pk α · α = α · α = ti−j,kα 0≤k and substituting in (1.2): X X pi pj C = AB = AiBjα α 0≤i (k) ti,j = ti−j,k−j 21 Therefore the number of non-zero entries in T0 is the number of non-zero entries in TN and so the multiplication between A and B in the normal basis representation of is completely determined by . Fpn TN 2 Denition 1.5 (see [14]). Let dN = # (i, k) ∈ {0, ... , n − 1} : ti,k 6= 0 be the number of non-zero entries in TN. Then dN is the complexity of the normal basis N and the product of two elements in with respect to this basis can be computed with at most Fpn multiplication and at most additions in as in general n · dN (dN − 1) · n Fp case. But while in the last one we must memorize a n × n-matrix, in the rst case we must recall n n × n-matrix. Obviously we wish to nd a normal basis such that dN is the smallest possible. The following theorem gives as a lower bound for dN. Theorem 1.2 (see [12]). Let be a normal basis in over with density N Fpn Fp dN. Then dN≥ 2n − 1 . Proof . Let p p2 pn−1 be the normal basis over . Let N = {α, α , α , ..., α } Fp Pn−1 pi be the trace of over and let be the T r(α) = i=0 α α Fp TN = (ti,k)0≤i,k X i T r(α) · α = (αp · α) 0≤i Since pi P pk we have (α · α) = 0≤k X X pk T r(α) · α = ti,kα 0≤i 22 Thus the sum of rows of TN is an n-tuple with T r(α) in position 1 and zeros elsewhere. Since is nonzero and pi is also a basis of over , α {αα : 0 ≤ i < n} Fpn Fp then the rows of TN are linearly indipendent. Therefore each column of TN must contain at least one nonzero element. Moreover with respect to (1.6) there are at least two nonzero elements in each column with the possible exception of column one. So the total number of nonzero elements in is at least TN 2n − 1 Denition 1.6 (Optimal normal bases (1), see [12, 14]). We say that N is an optimal normal basis of if d . Fpn N = 2n − 1 Now we illustrate through an example a common way to compute the pn−1 multiplication matrix TN with respect to a normal basis N = {α, ... , α }. EXAMPLE (Construction of TN) 1. We consider an irreducible minimal polynomial and let be f ∈ F2[x] α one of its roots. Thus we have the eld F2 5 = = F2 (x5 + x2 + 1) ( ) X i and = ai · α : ai ∈ F2 f(α) ≡ 0 0≤i<5 Set β = α3, then {β, β2, β4, β8, β16} is a normal basis, in fact β = α3 (mod f) β2 = α6 ≡ α3 + α (mod f) β4 = α12 ≡ α3 + α2 + α (mod f) β8 = α24 ≡ α4 + α3 + α2 + α (mod f) β16 = α48 ≡ α4 + α + 1 (mod f) 23 Then we have: 0 0 0 0 1 0 1 1 1 1 2 4 8 16 2 3 4 (β, β , β , β , β ) = (1, α, α , α , α ) · 0 0 1 1 0 1 1 1 1 0 0 0 0 1 1 and 0 0 0 0 1 0 1 1 1 1 0 0 1 1 0 6= 1 1 1 1 1 0 0 0 0 1 1 2. The computation of the products pi for in gives β · β 0 ≤ i < 5 F25 β · β = α3 · α3 ≡ α3 + α (mod f) β2 · β = α6 · α3 ≡ α4 + α3 + α (mod f) β4 · β = α12 · α3 ≡ α4 + α3 + α2 + α + 1 (mod f) β8 · β = α24 · α3 ≡ α3 + α + 1 (mod f) β16 · β = α48 · α3 ≡ α3 + α2 (mod f) 3. Now we write a matrix T such that in the left part contains the coefficient of the polynomial basis representation of β2i for i = 0, ..., 4, while in the right part contains the coefficient of the polynomial repre- 24 sentation of β2i · β. 0 0 0 0 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 0 T = 0 0 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 1 0 0 We can perform Gaussian elimination on T to write β · β, β2 · β, β4 · β, β8 · β, β16 · β as a linear combination of the conjugates of β. The output is then I4|T with I5 the 5 × 5-identity matrix and 0 0 1 1 1 1 1 1 0 1 T = 0 1 1 1 1 0 1 0 1 0 0 0 1 1 0 4. The multiplication matrix TN is the transposed matrix of T . Then β · β = β2 β2 · β = β2 + β22 + β23 β22 · β = β + β2 + β22 + β24 β23 · β = β + β22 + β23 + β24 β24 · β = β + β2 + β22 and so the density of the matrix TN is dN = 15. 1.3 Construction of the optimal normal bases We will now consider one construction of the optimal normal bases with the help of roots of unity and cyclotomic polynomials, for this reason we review some classical results: 25 Denition 1.7 (see [10]). Let n be a positive integer and let K(n) the splitting eld of xn − 1 over a eld K. The roots of xn − 1 in K(n) are called the n-th roots of unity over K and the set of this roots is denoted by E(n). Denition 1.8 (see [10, 14]). Let K a eld of characteristic p and n a positive integer not divisible by p. An element ς in a extension eld of K is called a primitive n-th root of unity if ςn = 1 and ςs 6= 1 for 0 < s < n . Thus the primitive n-th root of unity over K is a generator of the cyclic group E(n). Under the same condition of Denition 1.8 the polynomial n Y s Φn(x) = (x − ς ) s=1 gcd(s,n)=1 is called the n-th cyclotomic polynomial over K and ς0, ς1, ... , ςϕ(n) are the ϕ(n) primitive n-th roots of unity. Moreover every n-th root of unity over K is a primitive d-th root of unity over K, for exactly one positive divisor d of n. In fact, let ς be a primitive n-th root of unity over K and let ςs be an arbitrary n-th root of unity over K, then d = n/gcd(s, n) is the order of ςs, but since: n Y xn − 1 = (x − ςs) s=1 If we collect the factors (x − ςs) for which ςs is a primitive dth root of unity over K, we obtain the formula: n Y x − 1 = Qd(x) d|n and so it follows that xn − 1 Φn(x) = Y Φd(x) d|n d6=n 26 Theorem 1.3 (see [10, 13]). Let p be a prime power and let n be a positive integer such that gcd(n, p) = 1. Let d be the last positive integer such that d . Then is the splitting eld of and is the product p ≡ 1 (mod n) Fpd Φn Φn of φ(n)/d distinct monic irreducible polynomials of degree d. Proof . Let be any primitive -th root of unity over . If , pk α n Fp α ∈ Fpk α = α and so pk ≡ 1 (mod n). Since d is the least positive integer exponent such that d then is a multiple of and so . p ≡ 1 (mod n) k d α ∈ Fpd Now, since divides d then the cyclic group ∗ has a unique subgroup n p −1 Fpd of order n and so this subgroup contains all n-th roots of unity, i.e. all the roots of are in , then is the splitting eld of . Φn Fpd Fpd Φn Since is the least positive integer such that then the minimal d α ∈ Fpd polynomial of over has degree and because there are primitive α Fp d φ(n) n-th roots of unity then Φn can be factorized in φ(n)/d distinct irreducible polynomials of degree d, each one is a minimal polynomial of a primitive n-th roots of unity We note that from the last theorem it follows that Theorem 1.4. is irreducible over if and only if φ(n) . Φn Fp q ≡ 1 (mod n) Then from this we know when Φn is irreducible over a nite eld and we shall use these results in the next theorem that describes some optimal normal bases. Theorem 1.5 (Optimal normal bases (2), see [14]). Let n + 1 be a prime and be a primitive root modulo (i.e. modulo generates ∗ ). p n + 1 p n + 1 Fn+1 Let be a primitive -th root of unity in an extension eld of and ς (n + 1) Fp . Then p p2 pn−1 is an optimal normal basis of α = ς N = {α, α , α , ... , α } Fpn over . Fp Proof . From Theorem 1.2 and Theorem 1.3 we have that since p is a primitive root in , the minimal polynomial of is Fn+1 α (Xn+1 − 1) Φ = = Xn + Xn−1 + ... + 1 ∈ [X] n+1 (X − 1) Fp 27 and the (n + 1)-th roots of unity are linearly indipendent. Thus the set of the conjugates of , p pn , is a normal basis for . This α N = {α, α , ..., α } Fpn basis, as we have shown, is equal to the basis {α, α2, ... , αn}. i Now we denote with M = {α · α : i = 1, ... , n} the set of rows of TN and we note that the number of nonzero terms in the matrix TN is also the number of nonzero terms in the expansion of the set M in the basis N. Thus we have α · αi = αi+1 = αj for 1 ≤ j < n and X α · αn = 1 = − αi 1≤i≤n Therefore there are exactly (n − 1) + n = 2n − 1 nonzero terms in TN and so N is an optimal normal basis Theorem 1.6 (see [4]). Let n+1 be a prime, let p be a primitive root modulo so that i i (mod n+1). The basis p p2 pn−1 for n + 1 α = α {α, α , α , ... , α } Fpn over is the same as the basis 2 n for over . Fp {α, α , ... , α } Fpn Fp Proof . It is sufcient to show that {1, p, p2, ... , pn−1} = {1, 2, ... , n} in . Suppose and i j . Fn+1 0 ≤ j ≤ i ≤ n − 1 p ≡ p (mod n + 1) Then pj(pi−j − 1) ≡ 0 (mod n + 1) and so pi−j ≡ 1 (mod n + 1). Fur- thermore the order of p, that is n, divides i − j. But i − j < n then i = j. Hence {1, p, p2, ... , pn−1} are all distinct and {1, p, p2, ... , pn−1} = {1, 2, ... , n} We note, also, that the basis {α, α2, ... , αn} is dierent but similar to the traditional power basis n−1 for over . For switch {1, α, ... , α } Fpn Fp quickly between these two bases we use the identities: αn = −αn−1 − αn−2 − ... − α − 1 and α0 = −αn − αn−1 − ... − α Moreover we can reduce the exponents of α that are > n using the relation αi = αi (mod n+1) and the relation α0 = −αn − αn−1 − ... − α can be used 28 for exponents of α that are zero modulo n + 1. Thus as a consequence of the optimality of the bases the reduction stage of the multiplication in Fpn requires only additions in (see [7]). 2n − 1 Fp 29 Chapter 2 Arithmetic operations in Fp2 Now we describe how the computations in can be done eciently; for Fp2 this purpose a rapresentation of is needed that allows ecient arithmetic Fp2 operations. Let p ≡ 2 (mod 3), it follows that (X3 − 1)/(X − 1) = X2 + X + 1 is irriducibele over . Fp In fact we have that one root of the polynomial has the form √ −1 + −3 α = 2 and so X2 + X + 1 is irriducible if and only if −3 is a quadratic non-residue modulo p. Using the Legendre symbol1 it follows that: −3 −1 3 p−1 3 = · = (−1) 2 · p p p p then 1We recall that if a is an integer and p > 2 a prime, we dene the Legendre symbol a to equal or , as follows: p 0, 1 −1 0 if p|a a = 1 if a is a quadratic residue (mod p) p −1 if a is a nonresidue (mod p) (see [5]) 30 p−1 p−1 3 if is even and so 2 • 2 ⇒ p ≡ 1 (mod 4) (−1) · p = −1 p−1 p−1 3 if is odd and so 2 • 2 ⇒ p ≡ 3 (mod 4) (−1) · p = (−1) · (1) = −1 Therefore −3 is a quadratic non-residue modulo p and X2 + X + 1 is irriducible over , so ∼ 2 . Fp[X] Fp2 = Fp[X]/(X + X + 1) Moreover, since p ≡ 2 (mod 3), p is a primitive root modulo 3, i.e. p generates ∗. Then considering Theorem 1.5 the zeros and p of (mod 3) F3 α α the polynomial (X3 − 1)/(X − 1) = X2 + X + 1 form an optimal normal basis for over , i.e. Fp2 Fp ∼ p Fp2 = {x1α + x2α : x1, x2 ∈ Fp} . From αi = αi (mod 3) it follows that αp = α2+3k = α2 · 1k = α2 and so ∼ 2 2 Fp2 = x1α + x2α : α + α + 1 = 0 , x1, x2 ∈ Fp . Note that in this representation of an element of is represented by Fp2 t Fp −tα − tα2, e.g. 3 is represented by −3α − 3α2 (see [8]). Arithmetic operations in are carried out as follows. Fp2 Lemma 2.1 (see [8]). Let with prime. Not x, y, z ∈ Fp2 p ≡ 2 (mod 3) couting additions or subtractions in : Fp i. Computing xp is for free. ii. Computing 2 takes two multiplications in . x Fp iii. Computing takes three multiplications in . x · y Fp iv. Computing p takes four multiplications in . x · z − y · z Fp Proof . Let 2 we have that: x = x1α + x2α ∈ Fp2 p p p p 2p 2 x = x1α + x2α = x2α + x1α It follows that th powering in does not require arithmetic operations and p Fp2 thus can be considered to be for free, this prove i. 31 For squaring, we write: 2 2 2 2 2 4 3 (x1α + x2α ) = x1α + x2α + 2x1x2α (∗) because α3 ≡ 1 ≡ −α − α2 and α4 ≡ α both modulo α2 + α + 1 it follows 2 2 2 2 2 (∗) = x1α +x2α − 2x1x2α − 2x1x2α = x1(x1 − 2x2)α + x2(x2 − 2x1)α that prove ii. Let 2 and 2 and we compute x = x1α + x2α y = y1α + y2α ∈ Fp2 2 2 x · y = (x1α + x2α ) · (y1α + y2α ) = 2 = (x1y1α + x1y2 + x2y1 + x2y2α) = 2 = (x2y2 − x1y2 − x2y1)α + (x1y1 − x1y2 − x2y1)α using Karatsuba method (see Appendix A), rst compute x1 · y1, x2 · y2 and (x1 + x2)(y1 + y2), after which x1 · y2 + x2 · y1 and thus x · y follow using four subtractions. Finally let 2 2 2 , x = x1α + x2α , y = y1α + y2α , z = z1α + z2α ∈ Fp2 it follows that: x · z − y · zp = 2 2 2 2 p = (x1α + x2α ) · (z1α + z2α ) − (y1α + y2α ) · (z1α + z2α ) = 2 2 2 p p p 2p = (x1α + x2α ) · (z1α + z2α ) − (y1α + y2α ) · (z1 α + z2 α ) = 2 2 2 2 = (x1α + x2α ) · (z1α + z2α ) − (y1α + y2α ) · (z1α + z2α) with α2 + α + 1 ≡ 0 it follows 2 = x1 · z1α + x1 · z2 + x2 · z1 + x2 · z2α − 2 − y1 · z1 − y1 · z2α − y2 · z1α − y2 · z2 = 2 2 2 = x1 · z1α + x1 · z2 · (−α − α ) + x2 · z1 · (−α − α ) + x2 · z2α − 2 2 2 − y1 · z1 · (−α − α ) − y1 · z2α − y2 · z1α − y2 · z2 · (−α − α ) = = (z1 · (y1 − x2 − y2) + z2 · (x2 − x1 + y2))α + 2 + (z1 · (x1 − x2 + y1) + z2 · (y2 − x1 − y1)α ) 32 that prove iv. For comparison purposes we review the following results. Lemma 2.2 (see [9]). 2 Let with , and let with . x, y, z ∈ Fp6 p ≡ 5 (mod 7) s, t ∈ Z 0 < s, t < p i. Computing takes multiplications in . x · y 18 Fp ii. Computing 2 takes squarings in . x 18 Fp iii. Computing s takes an expected multiplications and x 9 log2 s 18 log2 s squarings in . Fp iv. Computing s t takes an expected multiplications x · x 13.5 log2 max(s, t) and squarings in . 18 log2 max(s, t) Fp Proof . Since , generates ∗ and 6 5 4 p ≡ 5 (mod 7) p F7 Φ7(X) = X + X + X + 3 2 . Let denote a root of , then can be represented X + X + X + 1 α Φ7(X) Fp6 using the optimal normal bases 2 6 over . {α, α , ... , α } Fp So multiplication and squarings in can be done in multiplications Fp6 18 and squarings in respectively, rather than as it is required by the classic Fp 36 algorithm for the multiplications. In fact, let 5 5 X i+1 X j+1 x = xiα and y = yjα i=0 j=0 using the Karatsuba algorithm, with proper adjustment of the powers of α, i.e. 4 4 x = X0 α + X1 α and y = Y0α + Y1α where X0,X1,Y0,Y1 are the second degree polynomials, we have that: 4 4 x · y = (X0α + X1α ) · (Y0α + Y1α ) 8 5 2 = X1Y1α + (X0Y1 + X1Y0)α + X0Y0α 2We remark that in the article [9] p is 2 (mod 3). Instead, our choice to take p ≡ 2 (mod 7) is a trick to have an optimal normal basis, as conrmed by a e-mail sent us by Martijn Stam, a A. K. Lenstra's student. 33 so that with z0 = X0Y0, z1 = X1Y1 and z2 = (X0 + X1) · (Y0 + Y1) 8 5 2 x · y = z1α + (z2 − z1 − z0)α + z0α Each of this zi can be computed using 6 multiplication, in fact, because 2 2 X0 = x0 + x1α + x2α and Y0 = y0 + y1α + y2α we have that: z0 = X0Y0 = 2 = x0y0 + (x0y1 + x1y0)α + (x0y2 + x1y1 + x2y0)α + 3 4 + (x1y2 + x2y1)α + x2y2α so that using Karatsuba method again, we set: z0 = x0y0, z1 = x1y1, z2 = x2y2, z3 = (x0 + x1) · (y0 + y1), z4 = (x0 + x2) · (y0 + y2), z5 = (x1 + x2) · (y1 + y2) thus 2 z0 = z0 + (z3 − z0 − z1)α + (z1 + z4 − z0 − z2)α + 3 4 + (z5 − z1 − z2)α + z2α z1 and z2 can be computed in a similar way. It follows that 18 multiplications (or squarings) are suce to compute x · y (or x2) and this proves i and ii. For iii we use the ordinary square and multiply method. Therefore we get squarings and expected multiplications in and so log2 s 0.5 log2 s Fp6 considering the result of i and ii we have multiplications and 9 log2 s 18 log2 s squarings in . Fp For iv we use standard multi-exponentiation (see Appendix B) and so we obtain squarings and multiplications in log2(max(s, t)) 0.75 log2(max(s, t)) which are equivalent to multiplications and Fp6 13.5 log2(max(s, t)) 18 log2(max(s, t)) squarings in . Fp 34 Chapter 3 XTR supergroup and XTR subgroup The XTR work environment is the multiplicative group of the nite eld . This cyclic group has order 6 , therefore only one cyclic subgroup Fp6 p − 1 with order p2 − p + 1 exsist (see [8]). The latter group is reffered to as the XTR supergroup, X . Because p2 − p + 1 not divide any ps − 1 for s = 1, 2, 3, X cannot be embedded in the multiplicative group of any true subeld of . Fp6 Let g be an element of order q > 3 dividing p2 − p + 1. The order q subgroup Y = hgi genereted by g is referred to as XTR subgroup (see [8]). We show, here below, that arbitrary powers of g can be represented using a single element of the subeld , and that such powers can be computed Fp2 eciently using arithmetic operations in , avoiding arithmetic in (see Fp2 Fp6 [9]). 3.1 Traces Denition 3.1. The trace over of is the sum of the T r(h) Fp2 h ∈ Fp6 conjugates over of h, i.e., Fp2 T r(h) = h + hp2 + hp4 35 Because , the order of divides 6 and so p6 p6−1 , h ∈ Fp6 h p − 1 h = h · h = h it follows that T r(h)p2 = (h + hp2 + hp4 )p2 = hp2 + hp4 + hp6 = hp2 + hp4 + h = T r(h) so that (see [8, 9]). T r(h) ∈ Fp2 Proposition 3.1. The function from to is an -linear applica- T r Fp6 Fp2 Fp2 tion, i.e. T r(h + k) = T r(h) + T r(k) T r(c · h) = c · T r(h) Proof . Let such that p2 , and let we have that c ∈ Fp2 c = c h, k ∈ Fp6 T r(h + k) = (h + k) + (h + k)p2 + (h + k)p4 = h + k + hp2 + kp2 + hp4 + kp4 = T r(h) + T r(k) T r(c · h) = c · h + cp2 · hp2 + cp4 · hp4 = c · h + c · hp2 + c · hp4 = c · ( h + hp2 + hp4 ) = c · T r(h) Now let ∗ be an element of order and such that divides g ∈ Fp6 q > 3 q p2 −p+1. The conjugates of g which order divide p2 −p+1 are g, gp2 = gp−1, since p2 ≡ p − 1 (mod p2 − p + 1), gp4 = g−p, since p4 ≡ (p − 1)2 ≡ p2 − 2p + 1 ≡ p − 1 − 2p + 1 ≡ −p (mod p2 − p + 1) and so T r(g) = g + gp2 + gp4 = g + gp−1 + g−p Mereover, since the order of divides 6 the trace over of equals g p − 1 Fp2 g the trace of the conjugates over of : Fp2 g 36 T r(g) = T r(gp2 ) = T r(gp4 ) From this last result and since in XTR elements of X are represented by their trace over , it follows that XTR makes no distinction between an Fp2 element of Y and its conjugates over (see [16]). = hgi Fp2 3.2 The polynomials F (c, X) Denition 3.2 (see [9]). For dene the polynomial c ∈ Fp2 3 2 p F (c, X) = X − cX + c X − 1 ∈ Fp2 [X] with (not necessarily distinct) roots , and dene h0, h1, h2 ∈ Fp6 [X] n n n for cn = h0 + h1 + h2 n ∈ Z. Now we considered c of the form T r(g) for g of order > 3 and dividing p2 − p + 1. We have the following result: Theorem 3.1 (see [9]). The roots of X3 − T r(g)X2 + T r(g)pX − 1 are the conjugates of g. Proof . We compare the coefficients of X3 − T r(g)X2 + T r(g)pX − 1 with the coefficients of the polynomial (X − g)(X − gp − 1)(X − g−p). The coefficients of X2 follows from g + gp − 1 + g−p = T r(g). The coefficients of X equals: g · g−p + g · gp − 1 + g−p · gp − 1 = gp + g1 − p + g−1 Since 1 − p ≡ − p2 mod p2 − p + 1 and −1 ≡ p2 − p mod p2 − p + 1 we nd that: gp + g1 − p + g−1 = gp + g−p2 + gp2 − p = (g + g−p + gp − 1)p = T r(g)p 37 The constant coefficients is the product of the conjugates: g · g−p · gp − 1 = g1 − p + p − 1 = g0 = 1 which completes the proof. Therefore p − 1 −p 3 2 p (X − g)(X − g )(X − g ) = X − T r(g)X + T r(g) X − 1 ∈ Fp2 [X] is actually the minimal polynomial of over and so this polynomial and g Fp2 the conjugates of are fully determined by . g T r(g) ∈ Fp2 The same holds for any power of g, in fact for any integer n the conjugates of n are the roots of 3 n 2 n p , and the g X − T r(g )X + T r(g ) X − 1 ∈ Fp2 [X] latter polynomial and the conjugates of n are determined by n . g T r(g ) ∈ Fp2 This observation is useful for cryptographic purposes if there is a way to eciently compute T r(gn) given T r(g). In cryptographic protocols, then, n can be replaced by n , thereby obtaining a saving of a g ∈ Fp6 T r(g ) ∈ Fp2 factor 3 in the rapresentation size (see [8]). We will show that T r(gn) can indeed be computed quickly given T r(g), so that a considerable speed advantage is obtained. For this purpose now we consider the properties of the polynomial X3 − 2 p for general as in Denition 3.2. . cX + c X − 1 c ∈ Fp2 3.3 Properties of F (c, X) and its roots Lemma 3.1. Properties of F (c, X), see [9] i. −p for . F (c, hj ) = 0 j = 0, 1, 2 ii. Either all have order dividing 2 and or all . hj p − p + 1 > 3 hj ∈ Fp2 Proof i. From 3 2 p it follows that F (c, hj) = hj − chj + c hj − 1 = 0 hj 6= 0 38 and that p 0 = F (c, hj) = 3p p 2p p2 p = hj − c hj + c hj − 1 = 3p p −p −2p −3p = −hj · (−1 + c hj − chj + hj ) = 3p −p = −hj · F (c, hj ) where and p2 . Therefore −p and thus for all root , hj 6= 0 c = c F (c, hj ) = 0 hj its power −p is also root of the polynomial . hj F (c, X) Proof ii. From i it follows, without loss of generality, that we have three possibility: 1. −p for . hj = hj j = 0, 1, 2 2. −p −p −p . h0 = h0 , h1 = h2 , h2 = h1 3. −p for . hj = hj+1 mod 3 j = 0, 1, 2 In the rst case all have order dividing and thus in , in fact we hj p + 1 Fp2 have: p+1 p −1 hj = hj · hj = hj · hj In the second case, has order dividing because −p. While h0 p + 1 h0 = h0 −p p2 and −p p2 , so that and both have orders h1 = h2 = h1 h2 = h1 = h2 h1 h2 dividing 2 and thus . p − 1 h1, h2 ∈ Fp2 In the last case it follows from 1 = h0 · h1 · h2 that −p −p p2 −p p2 − p + 1 1 = h0 · h1 · h2 = h0 · h2 · h0 = h0 · h0 · h0 = h0 2 so that h0 and similarly h1 and h2 have order dividing p − p + 1 Moreover if either one, say h0, has order at most 3, then h0 has order 1 or 3 since p2 − p + 1 is odd. Since 3 divide p2 − 1, in fact p2 ≡ 1 mod 3, it follows that the order of divides 2 so that . But then and are in as well, h0 p − 1 h0 ∈ Fp2 h1 h2 Fp2 because they are power of h0. 39 It follows that while in the rst and second case the roots are in , in Fp2 2 the last case either all hj have order dividing p − p + 1 and > 3, i.e. hj ∈ X for , or all are in . j = 0, 1, 2 hj Fp2 Recall that, as in Denition 3.2, n n n. Now we show its cn = h0 + h1 + h2 properties. Lemma 3.2. Properties of cn, see [9] i. c = c1. ii. n n n n n n for c−n = h0 · h1 + h0 · h2 + h1 · h2 n ∈ Z. iii. p for . c−n = cnp = cn n ∈ Z iv. for . cn ∈ Fp2 n ∈ Z v. p for . cu+v = cu · cv − cv · cu−v + cu−2v u, v ∈ Z Proof . The proof follows from the denition of cn in Denition 3.2, in fact it follows that c1 = h0 + h1 + h2 = c For ii, because h0 · h1 · h2 = 1 it follows that −1 n −n h1 · h2 = h0 ⇒ (h1 · h2) = h0 −1 n −n h0 · h2 = h1 ⇒ (h0 · h2) = h1 −1 n −n h0 · h1 = h2 ⇒ (h0 · h1) = h2 therefore n n n n n n n n n (h1 · h2) + (h0 · h2) + (h0 · h1) = h1 · h2 + h0 · h2 + h0 · h1 = −n −n −n = h0 + h1 + h2 = c−n Now we consider the three cases of the proof of ii in Lemma 3.1 (Properties of F (c, X)): 1. If −p for then np −n and thus −n hj = hj j = 0, 1, 2 hj = hj c−n = h0 + −n −n np np np . h1 + h2 = h0 + h1 + h2 = cnp 40 2. If −p −p and −p then −n −n −n h0 = h0 , h1 = h2 h2 = h1 c−n = h0 + h1 + h2 = np np np . h0 + h1 + h2 = cnp 3. if −p for then −n −n −n hj = hj+1 mod 3 j = 0, 1, 2 c−n = h0 + h1 + h2 = np np np . h1 + h2 + h0 = cnp Moreover n n n p p that proves iii. cnp = (h0 + h1 + h2 ) = cn If all , then iv is immediate. Otherwise, it follows from Lemma hj ∈ Fp2 .ii that1 is irreducible if and only if its roots have order 3.1 F (c, X) ∈ Fp2 [X] dividing p2 − p + 1 and are > 3, so we have that F (c, X) is irreducible and its roots are the conjugates of . Thus n , which concludes h0 cn = T r(h0 ) ∈ Fp2 the proof of iv. By the denition of , p (cf. Property iii) and the relationship cn c−n = cn n n n , the proof of v follows from a staightforward computation. h0 + h1 + h2 = 1 In fact we have that p cu · cv − cv · cu−v + cu−2v = u u u v v v v v v p = (h0 + h1 + h2 ) · (h0 + h1 + h2) − (h0 + h1 + h2) · u−v u−v u−v u−2v u−2v u−2v · (h0 + h1 + h2 ) + (h0 + h1 + h2 ) = By the relationship p it follows c−n = cn u+v u+v u+v u v u v u v u v = h0 + h1 + h2 + h0 · h1 + h0 · h2 + h1 · h0 + h1 · h2 + u v u v −v −v −v u−v u−v u−v + h2 · h0 + h2 · h1 − (h0 + h1 + h2 ) · (h0 + h1 + h2 ) + u−2v u−2v u−2v + (h0 + h1 + h2 ) = u+v u+v u+v u v u v u v u v = h0 + h1 + h2 + h0 · h1 + h0 · h2 + h1 · h0 + h1 · h2 + u v u v u−2v u−2v u−2v −v u−v + h2 · h0 + h2 · h1 − h0 − h1 − h2 − h0 · h1 + −v u−v −v u−v −v u−v −v u−v − h0 · h2 − h1 · h0 − h1 · h2 − h2 · h0 + −v u−v u−2v u−2v u−2v + h2 · h1 + h0 + h1 + h2 = (∗) 1We remember that The polynomial f ∈ F [X] of degree 2 or 3 is irriducible in F [X] if and only if f has no root in F (see [10], Theorem 1.69). 41 Now if we use the relation n n n , it follows that h0 + h1 + h2 = 1 u−2v u−2v u−2v − h0 − h1 − h2 = −1 u−2v u−2v u−2v h0 + h1 + h2 = 1. Moreover −v v v −v v v −v v v h0 = h1 · h2, h1 = h0 · h2, h2 = h0 · h1 thus u+v u+v u+v u v u v u v u v (∗) = h0 + h1 + h2 + h0 · h1 + h0 · h2 + h1 · h0 + h1 · h2 + u v u v u v v u u v v u + h2 · h0 + h2 · h1 − h1 · h2 − h1 · h2 − h0 · h2 − h0 · h2 + u v v u + h0 · h1 − h0 · h1 = u+v u+v u+v = h0 + h1 + h2 = cu+v. Theorem 3.2 (see [9]). n for and . F (cn, hj ) = 0 j = 0, 1, 2 n ∈ Z Proof . We compute the coefficients of n n n and (X − h0 )(X − h1 )(X − h2 ) compare this coefficients with the coefficients of the polynomial 3 2 p F (cn,X) = X − cnX + cnX − 1 ∈ Fp2 . We have: n n n (X − h0 )(X − h1 )(X − h2 ) = 2 n n n n n = (X − h1 X − h0 X + h0 h1 )(X − h2 ) = 3 n 2 n 2 n 2 n n n n n n = X − h1 X − h0 X − h2 X + h0 h1 X + h1 h2 X + h0 h2 X + n n n + h0 h1 h2 = 3 n n n 2 n n n n n n n n n = X − (h0 + h1 + h2 )X + (h0 h1 + h0 h2 + h1 h2 )X − h0 h1 h2 We nd that the coefcient of 2 equals n n n ,the X − (h0 + h1 + h2 ) = −cn coefficient of equals n n n n n n p (cf. Lemma 3.2.iii) X (h0 h1 + h0 h2 + h1 h2 ) = c−n = cn and nally the constant coefcient equals n n n n − h0 h1 h2 = −(h0h1h2) = −1 42 Thus it follows that n n n and so (X − h0 )(X − h1 )(X − h2 ) = F (cn,X) n for . F (cn, hj ) = 0 j = 0, 1, 2 Theorem 3.3 (see [9]). is riducible over if and only if . F (c, X) Fp2 cp+1 ∈ Fp Proof . If is riducible then all are in for (Lemma (⇒) F (c, X) hj Fp2 j = 0, 1, 2 3.1.ii) (We remember the equivalence in proof iv of the (Lemma 3.2)). It follows that p+1 p p2+p p+1 p+1 for and so also their sum (hj ) = hj = hj ⇒ hj ∈ Fp j = 0, 1, 2 p+1 p+1 p+1 . h0 + h1 + h2 = cp+1 ∈ Fp If then p and 3 2 (⇐) cp+1 ∈ Fp cp+1 = cp+1 F (cp+1,X) = X − cp+1X + cp+1X − 1 thus 1 is root of F (cp+1,X), i.e. F (cp+1, 1) = 0. th Since the roots of F (cp+1,X) are the (p + 1) powers of the roots of F (c, X) (cf. Theorem 3.2), it follows that F (c, X) has a root of order dividing and so 2 , i.e. an element of , so that is riducible over p + 1 p − 1 Fp2 F (c, X) . Fp2 We conclude this section observing that the Theorem 3.2 is fundamental. n n From this theorem follows that for cn = T r(g ) the conjugates of g are the roots of 3 n 2 n p and this polynomial with X − T r(g )X + T r(g ) X − 1 ∈ Fp2 [X] gn's conjugates are fully determined by T r(gn), as we claimed on the other hand with this result we have a compact rappresentation of every powers of replacing n ∗ with n . g g ∈ Fp6 T r(g ) ∈ Fp2 3.4 The computation of cn In the last section, we have show the properties of cn, the same properties that lead to a fast algorithm to compute for any . cn n ∈ Z In fact we have the following results: Corollary 3.1 (see [9]). Assume that c, cn−1, cn and cn+1 are given. Then i. Computing 2 p takes two multiplications in . c2n = cn − 2cn Fp 43 p ii. Computing cn+2 = c · cn+1 − c · cn + cn−1 takes four multiplications in . Fp iii. Computing p p p takes four multiplications c2n−1 = cn−1 ·cn − c ·cn + cn+1 in . Fp iv. Computing p p takes four multiplications c2n+1 = cn+1 · cn − c · cn + cn−1 in . Fp Proof . The identities follows from Lemma 3.2 .iii, .iv . In fact from p cu+v = cu · cv − cv · cu−v + cu−2v for i, let u = v = n and c0 = 3. We have p c2n = cn · cn − cn · 3 + c−n and since p following 2 p c−n = cn c2n = cn − 2cn. For ii, let u = n + 1 and v = 1. We have p cn+2 = cn+1 · c − c · cn + cn−1 For iii, let u = n − 1 and v = n. We have p c2n−1 = cn−1 · cn − cn · c−1 + c−(n+1) and since p it follows p p . c−n = cn c2n−1 = cn−1 · cn − c · cn + cn−1 Finally for iv, let u = n + 1 and v = n. We have p c2n+1 = cn+1 · cn − cn · c + c−(n−1) and since p it follows p p c−n = cn c2n+1 = cn+1 · cn − cn · c + c(n−1). Now we compute the computational costs of these last four identities, considering the Lemma 2.1. In the rst identity, since , we compute only 2 and that p ≡ 2 mod 3 cn takes two multiplications in , while to compute the cost of the three last Fp identities we consider the relation x·z − y·zp that takes four multiplications in , setting , and for ii, , p and Fp x = cn+1 y = cn z = c x = cn−1 y = c z = cn for iii, and nally x = cn+1, y = c and z = cn for iv. 44 Denition 3.3. Let 3 Sn(c) = (cn−1, cn, cn+1) ∈ (Fp2 ) Algorithm 3.1 (Computation of Sn(c) given n and c, see [8, 9]) 1. If n < 0 apply this algorithm to −n and c, and apply the relation p to the resulting value, obtaining c−n = cnp = cn