Advertisements

# Schoof's algorithm: Wikis

Advertisements

Note: Many of our articles have direct quotes from sources you can cite, within the Wikipedia article! This article doesn't yet, but we're working on it! See more info or our list of citable articles.

# Encyclopedia

Advertisements

### From Wikipedia, the free encyclopedia

Schoof's Algorithm is an efficient algorithm to count points on elliptic curves over finite fields. The algorithm has applications in elliptic curve cryptography where it is important to know the number of points to judge the difficulty of solving the discrete logarithm problem in the group of points on an elliptic curve.

The algorithm was published by René Schoof in 1985 and it was a theoretical breakthrough, as it was the first deterministic polynomial time algorithm for counting points on elliptic curves. Before Schoof's algorithm, approaches to counting points on elliptic curves such as the naive and baby-step giant-step algorithms were, for the most part, tedious and had an exponential running time.

This article explains Schoof's approach, laying emphasis on the mathematical ideas underlying the structure of the algorithm.

## Introduction

Let E be an elliptic curve defined over the finite field $\mathbb{F}_{q}$, where q = pn for p a prime and n an integer $\geq 1$. Over a field of characteristic $\neq 2, 3$ an elliptic curve can be given by a (short) Weierstrass equation y2 = x3 + Ax + B with $A,B\in \mathbb{F}_{q}$. The set of points defined over $\mathbb{F}_{q}$ consists of the solutions $(a,b)\in\mathbb{F}_{q}^2$ satisfying the curve equation and a point at infinity O. Using the group law on elliptic curves restricted to this set one can see that this set $E(\mathbb{F}_{q})$ forms an abelian group, with O acting as the zero element. In order to count points on an elliptic curve, we compute the cardinality of $E(\mathbb{F}_{q})$. Schoof's approach to computing the cardinality $\sharp E(\mathbb{F}_{q})$ makes use of Hasse's theorem on elliptic curves along with the Chinese remainder theorem and division polynomials.

## Hasse's Theorem

Hasse's theorem states that if $E/\mathbb{F}_{q}$ is an elliptic curve over the finite field $\mathbb{F}_{q}$, then $\sharp E(\mathbb{F}_{q})$ satisfies

$\mid q + 1 - \sharp E(\mathbb{F}_{q}) \mid \leq 2\sqrt{q}.$

This powerful result, given by Hasse in 1934, simplifies our problem by narrowing down $\sharp E(\mathbb{F}_{q})$ to a finite (albeit large) set of possibilities. Defining t to be $q + 1 - \sharp E(\mathbb{F}_{q})$, and making use of this result, we now have that computing the cardinality of t modulo N where $N > 4\sqrt{q}$, is sufficient for determining t, and thus $\sharp E(\mathbb{F}_{q})$. While there is no efficient way to compute t(mod N) directly for general N, it is possible to compute t(mod l) for l a small prime, rather efficiently. We choose S = {l1,l2,...,l r} to be a set of distinct primes such that $\prod l_i = N > 4\sqrt{q}$. Given t(mod l)i for all $l_i\in S$, the Chinese remainder theorem allows us to compute t(mod N).

In order to compute t(mod l) for a prime $l \neq p$, we make use of the theory of the Frobenius endomorphism φ and division polynomials. Note that considering primes $l \neq p$ is no loss since we can always pick a bigger prime to take its place to ensure the product is big enough. In any case Schoof's algorithm is most frequently used in addressing the case q = p since there are more efficient, so called p adic algorithms for small characteristic fields.

## The Frobenius Endomorphism

Given the elliptic curve E defined over $\mathbb{F}_{q}$ we consider points on E over $\overline{\mathbb{F}_{q}}$, the algebraic closure of $\mathbb{F}_{q}$; i.e. we allow points with coordinates in $\bar{\mathbb{F}}_{q}$. The Frobenius endomorphism of $\bar{\mathbb{F}}_{q}$ over $\mathbb{F}_{q}$ extends to the elliptic curve by $\phi : (x, y) \mapsto (x^{q}, y^{q})$.

This map is the identity on $E(\mathbb{F}_{q})$ and one can extend it to the point at infinity O, making it a group morphism from $E(\bar{\mathbb{F}_{q}})$ to itself.

The Frobenius endomorphism satisfies a quadratic polynomial which is linked to the cardinality of $E(\mathbb{F}_{q})$ by the following theorem:

Theorem: The Frobenius endomorphism given by φ satisfies the characteristic equation

φ2tφ + q = 0, where $t = q + 1 - \sharp E(\mathbb{F}_{q})$

Thus we have for all $P=(x, y) \in E$ that $(x^{q^{2}}, y^{q^{2}} ) + q(x, y) = t(x^{q}, y^{q})$, where + denotes addition on the elliptic curve and q(x,y) and t(xq,y q) denote scalar multiplication of (x,y) by q and of (xq,y q) by t.

One could try to symbolically compute these points $(x^{q^{2}}, y^{q^{2}})$, (xq,y q) and q(x,y) as functions in the coordinate ring $\mathbb{F}_{q}[x,y]/(y^{2}-x^{3}-Ax-B)$ of E and the search for a value of t which satisfies the equation. However, the degrees get very large and this approach is impractical.

Schoof's idea was to carry out this computation restricted to points of order l for various small primes l Fixing an odd prime l, we now move on to solving the problem of determining tl, defined as t(mod l), for a given prime $l \neq 2, p$. If a point (x,y) is in the l-torsion subgroup $E[l]=\{P\in E(\bar{\mathbb{F}_{q}}) \mid lP=O \}$, then $qP = \bar{q}P$ where $\bar{q}$ is the unique integer such that $q \equiv \bar{q} \pmod l$ and $\mid \bar{q} \mid< l/2$. Note that φ(O) = O and that for any integer r we have rφ(P) = φ(rP). Thus φ(P) will have the same order as P. Thus for (x,y) belonging to E[l], we also have $t(x^{q}, y^{q})= \bar{t}(x^{q}, y^{q})$ if $t \equiv \bar{t} \pmod l$. Hence we have reduced our problem to solving the equation

$(x^{q^{2}}, y^{q^{2}}) + \bar{q}(x, y) \equiv \bar{t}(x^{q}, y^{q}),$ where $\bar{t}$ and $\bar{q}$ have integer values in [ − (l − 1) / 2,(l − 1) / 2].

## Computation modulo primes

The lth division polynomial is such that its roots are precisely the x coordinates of points of order l. Thus, to restrict the computatio of $(x^{q^{2}}, y^{q^{2}}) + \bar{q}(x, y)$ to the l-torsion points means computing these expressions as functions in the coordinate ring of E and modulo the lth division polynomial. I.e. we are working in $\mathbb{F}_{q}[x,y]/(y^{2}-x^{3}-Ax-B, \psi_{l})$. This means in particular that the degree of X and Y defined via $(X(x,y),Y(x,y)):=(x^{q^{2}}, y^{q^{2}}) + \bar{q}(x, y)$ is at most 1 in y and at most (l2 − 3) / 2 in x.

The scalar multiplication $\bar{q}(x, y)$ can be done either by double-and-add methods or by using the $\bar{q}$th division polynomial. The latter approach gives:

$\bar{q} (x,y) = (x_{\bar{q}},y_{\bar{q}}) = \left( x - \frac {\psi_{\bar{q}-1} \psi_{\bar{q}+1}}{\psi^{2}_{\bar{q}}}, \frac{\psi_{2\bar{q}}}{2\psi^{4}_{\bar{q}}} \right)$

where ψn is the nth division polynomial. Note that $y_{\bar{q}}/y$ is a function in x only and denote it by θ(x).

We must split the problem into two cases: the case in which $(x^{q^{2}}, y^{q^{2}}) \neq \pm \bar{q}(x, y)$, and the case in which $(x^{q^{2}}, y^{q^{2}}) = \pm \bar{q}(x, y)$. Note that these equalities are checked modulo ψl.

### Case 1: $(x^{q^{2}}, y^{q^{2}}) \neq \pm \bar{q}(x, y)$

By using the addition formula for the group $E(\mathbb{F}_{q})$ we obtain:

$X(x,y) = \left( \frac{y^{q^{2}} - y_{\bar{q}}}{x^{q^{2}} - x_{\bar{q}}} \right) ^{2} - x^{q^{2}} - x_{\bar{q}}.$ Note that this computation fails in case the assumption of inequality was wrong.

We are now able to use the x-coordinate to narrow down the choice of $\bar{t}$ to two possibilities, namely the positive and negative case. Using the y-coordinate one later determines which of the two cases holds.

We first show that X is a function in x alone. Consider $(y^{q^{2}} - y_{\bar{q}})^{2}=y^{2}(y^{q^{2}-1}-y_{\bar{q}}/y)^{2}$. Since q2 − 1 is even, by replacing y2 by x3 + Ax + B, we rewrite the expression as $(x^3+Ax+B)((x^3+Ax+B)^{\frac{q^{2}-1}{2}}-\theta(x))$ and have that $X(x)\equiv (x^3+Ax+B)((x^3+Ax+B)^{\frac{q^{2}-1}{2}}-\theta(x))\bmod \psi_l(x).$

Now if $X \equiv x^{q} _ {\bar{t}}\bmod \psi_l(x)$ for one $\bar{t}\in [0,(l-1)/2]$ then $\bar{t}$ satisfies $\phi ^{2}(P) \mp \bar{t} \phi(P) + \bar{q}P = O$ for all l-torsion points P.

As mentioned earlier, using Y and $y_{\bar{t}}^{q}$ we are now able to determine which of the two values of $\bar{t}$ ($\bar{t}$ or $-\bar{t}$) works. This gives the value of $t\equiv \bar{t}\pmod l$. Schoof's algorithm stores the values of $\bar{t}\pmod l$ in a variable tl for each prime l considered.

### Case 2: $(x^{q^{2}}, y^{q^{2}}) = \pm q(x, y)$

We begin with the assumption that $(x^{q^{2}}, y^{q^{2}}) = \bar{q}(x, y)$. Since l is an odd prime it cannot be that $\bar{q}(x, y)=-\bar{q}(x, y)$ and thus $\bar{t}\neq 0$. The characteristic equation yields that $\bar{t} \phi(P) = 2\bar{q} P$. And consequently that $\bar{t}^{2}\bar{q} \equiv (2q)^{2} \pmod l$. This implies that q is a square modulo l. Let $q \equiv w^{2} \pmod l$. Compute wφ(x,y) in $\mathbb{F}_{q}[x,y]/(y^{2}-x^{3}-Ax-B, \psi_{l})$ and check whether $\bar{q}(x, y)=w\phi(x,y)$. If so, tl is $\pm 2w \pmod l$ depending on the y-coordinate.

If q turns out not to be a square modulo l or if the equation does not hold for any of w and w, our assumption that $(x^{q^{2}}, y^{q^{2}}) = +\bar{q}(x, y)$ is false, thus $(x^{q^{2}}, y^{q^{2}}) = - \bar{q}(x, y)$. The characteristic equation gives tl = 0.

### Additional Case: l = 2

If you recall, our initial considerations omit the case of l = 2. Since we assume q to be odd, $q + 1 - t \equiv t \pmod 2$ and in particular, $t_{2} \equiv 0 \pmod 2$ if and only if $E(\mathbb{F}_{q})$ has an element of order 2. By definition of addition in the group, any element of order 2 must be of the form (x0,0). Thus $t_{2} \equiv 0 \pmod 2$ if and only if the polynomial x3 + Ax + B has a root in $\mathbb{F}_{q}$, if and only if $\gcd(x^{q}-x, x^{3} + Ax + B)\neq 1$.

## The Algorithm

(1) Choose a set of odd primes S, $p \notin S$ such that $N=\prod_{l\in S} l > 2\sqrt{q}.$
(2) put t2 = 0 if $gcd(x^{q}-x, x^{3} + Ax + B)\neq 1$, else t2 = 1.
(3) for $l \in S$ do:
(a) Let $\bar{q}$ be the unique integer such that $q \equiv \bar{q} \pmod l$ and $\mid \bar{q} \mid< l/2$. Compute ψl. All following computations in this loop are in the following ring: $\mathbb{F}_{q}[x,y]/(y^{2}-x^{3}-Ax-B, \psi_{l}).$
(b) Compute (xq,y q), $(x^{q^{2}}, y^{q^{2}})$ and $(x_{\bar{q}},y_{\bar{q}})$ .
(c) if $x^{q^{2}}\neq x_{\bar{q}}$ then
(i) compute (X,Y).
(ii)for $1\leq \bar{t} \leq (l-1)/2$ do
(iii)if $X = x^{q} _ {\bar{t}}$ then
(iv)if $Y = y^{q} _ {\bar{t}}$ then $t_{l}=\bar{t}$; else $t_{l}=-\bar{t}$.
(d)else if q is a square modulo l then
(i)compute w with $q\equiv w^{2} \pmod l$
(ii)compute w(xq,y q)
(iii)if $w(x^{q}, y^{q})=(x^{q^{2}}, y^{q^{2}})$ then tl = 2w
(iv)else if $w(x^{q}, y^{q})=(x^{q^{2}}, -y^{q^{2}})$ then tl = − 2w
(v)else tl = 0
(e)else tl = 0
(4)Use the Chinese Remainder Theorem to compute $\sharp E(\mathbb{F}_{q}) \pmod{2N}$.

Note that since the set S was chosen so that $2N>4\sqrt{q}$, by Hasse's theorem, we in fact know $\sharp E(\mathbb{F}_{q})$ precisely.

## Complexity of Schoof's Algorithm

Most of the computation is taken by the evaluation of φ(P) and φ2(P), for each prime l, that is computing xq, yq, $x^{q^2}$, $y^{q^2}$ for each prime l. This involves exponentiation in the ring $R = \mathbb{F}_{q}[x, y]/ (y^2-x^3-Ax-B, \psi_l)$ and requires O(logq) multiplications. Since the degree of ψl is $\frac{l^2-1}{2}$, each element in the ring is a polynomial of degree O(l2). By the prime number theorem, we have around O(logq) primes of size O(logq) giving that l is O(logq) and we obtain that O(l2) = O(log2q). Thus each multiplication in the ring R requires O(log4q) multiplications in $\mathbb{F}_{q}$ which in turn requires O(log2q) bit operations. In total, the number of bit operations for each prime l is O(log7q). Given that this computation needs to be carried out for each of the O(logq) primes, the total complexity of Schoof's algorithm turns out to be O(log8q). Note that fast polynomial arithmetic reduces the costs down to O(log5q).

## Improvements to Schoof's Algorithm

In the 1990s, Noam Elkies, followed by A. O. L. Atkin, devised improvements to Schoof's basic algorithm by restricting the set of primes $S = \{l_1, \ldots, l_s\}$ considered before to primes of a certain kind. These came to be called Elkies primes and Atkin primes respectively. A prime l is called an Elkies prime if the characteristic equation: φ2tφ + q = 0 splits over $\mathbb{F}_l$, while an Atkin prime is a prime that is not an Elkies prime. Atkin showed how to combine information obtained from the Atkin primes with the information obtained from Elkies primes to produce an efficient algorithm, which came to be known as the Schoof-Elkies-Atkin algorithm. The first problem to address is to determine whether a given prime is Elkies or Atkin. In order to do so, we make use of modular polynomials, which come from the study of modular forms and an interpretation of elliptic curves over the complex numbers as lattices. Once we have determined which case we are in, instead of using division polynomials, we proceed by working modulo the modular polynomials fl which have a lower degree than the corresponding division polynomial ψl (degree O(l) rather than O(l2)). This results in a further reduction in the running time, giving us an algorithm more efficient than Schoof's, with complexity O(log6q) for standard arithmetic and O(log4q).

## Implementations

Several algorithms were implemented in C++ by Mike Scott and are available with source code. The implementations are free (no terms, no conditions), but they use MIRACL library which is only free for non-commercial use. Note that (unmodified) programs may be used to generate curves for commercial use. There are

• Schoof's algorithm implementation for $E(\mathbb{F}_p)$ with prime p.
• Schoof's algorithm implementation for $E(\mathbb{F}_{2^m})$.

## References

• R. Schoof: Elliptic Curves over Finite Fields and the Computation of Square Roots mod p. Math. Comp., 44(170):483-494, 1985. Available at http://www.mat.uniroma2.it/~schoof/ctpts.pdf
• R. Schoof: Counting Points on Elliptic Curves over Finite Fields. J. Theor. Nombres Bordeaux 7:219-254, 1995. Available at http://www.mat.uniroma2.it/~schoof/ctg.pdf
• G. Musiker: Schoof's Algorithm for Counting Points on $E(\mathbb{F}_{q})$. Available at http://www-math.mit.edu/~musiker/schoof.pdf
• A. Brown: Algorithms for Elliptic Curves over Finite Fields, EPFL - LMA. Available at http://algo.epfl.ch/handouts/en/andrew.pdf
• V. Müller : Die Berechnung der Punktanzahl von elliptischen kurven über endlichen Primkörpern. Master's Thesis. Universität des Saarlandes, Saarbrücken, 1991. Available at http://lecturer.ukdw.ac.id/vmueller/publications.php
• A. Enge: Elliptic Curves and their Applications to Cryptography: An Introduction. Kluwer Academic Publishers, Dordrecht, 1999.
• L. C. Washington: Elliptic Curves: Number Theory and Cryptography. Chapman & Hall/CRC, New York, 2003.
• N. Koblitz: A Course in Number Theory and Cryptography, Graduate Texts in Math. No. 114, Springer-Verlag, 1987. Second edition, 1994

Advertisements

 Got something to say? Make a comment. Your name Your email address Message