10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

7.5 Counting points on elliptic curves 355<br />

if(P1 + P2 == O) return 0; // #E = p +1− t with t ≡ 0(modl).<br />

P3 = P0;<br />

for(1 ≤ k ≤ l/2) {<br />

if(X-coordinates of (P1 + P2) and P3 match) {<br />

if(Y -coordinates also match) return k; // Y -coordinate check.<br />

return l − k;<br />

}<br />

P3 = P3 + P0;<br />

}<br />

In the addition tests above for matching of some coordinate between (P1 +P2)<br />

and P3, one is asking generally whether<br />

(N1/D1,YM1/C1)+(N2/D2,YM2/C2) =(N3/D3,YM3/C3),<br />

and such a relation is to be checked, of course, using the usual elliptic addition<br />

rules. The polynomial P1 + P2 on the left can be combined—using the elliptic<br />

rules of Algorithm 7.2.2, with the coordinates in that algorithm being now, of<br />

course, our polynomial ratios—into polynomial form (N ′ /D ′ ,YM ′ /C ′ ), and<br />

this is compared with (N3/D3,YM3/C3).Forsuchcomparisoninturnone<br />

checks whether the cross products (N3D ′ − N ′ D3) and(M3C ′ − M ′ C3) both<br />

vanish mod (Ψl,p). As for the check on whether P1 + P2 = O, we are asking<br />

whether M1/C1 = −M2/C2, and this is also an easy cross product relation.<br />

The idea is that the entire implementation we are describing involves only<br />

polynomial multiplication and the mod (Ψl,p) reductions throughout. And<br />

as we have mentioned, both polynomial multiply and mod can be made quite<br />

efficient.<br />

In case an attempt is made by the reader to implement Algorithm 7.5.6,<br />

we give here some small cases within the calculation, for purpose of, shall we<br />

say, “algorithm debugging.” For p = 101 and the curve<br />

Y 2 = X 3 +3X +4<br />

over Fp, the algorithm gives, for l selections l =2, 3, 5, 7, the results t mod 2 =<br />

0, t mod 3 = 1, t mod 5 = 0, t mod 7 = 3, from which we infer #E = 92.<br />

(We might have skipped the prime l = 5, since the product of the other primes<br />

exceeds 4 √ p.) Along the way we have, for example,<br />

<br />

X p2<br />

,Y p2<br />

[2](X, Y )=<br />

Ψ3 =98+16X +6X 2 + X 4 ,<br />

= 32 + 17X +13X 2 +92X 3 , Y(74 + 96X +14X 2 +68X 3 ) ,<br />

2<br />

12 + 53X +89X<br />

16 + 12X +4X3 , Y 74 + 10X +5X2 +64X3 27 + 91X +96X2 +37X3 <br />

,<br />

(X p ,Y p )= 70 + 61X +83X 2 +44X 3 , Y(43 + 76X +21X 2 +25X 3 ) ,<br />

where it will be observed that every polynomial appearing in the point<br />

coordinates has been reduced mod (Ψ3,p). (Note that p in Step [Analyze

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!