Prime Numbers
Prime Numbers Prime Numbers
7.2 Elliptic arithmetic 329 Before we discuss option (4) for elliptic arithmetic, we bring in an extraordinarily useful idea, one that has repercussions far beyond option (4). Definition 7.2.5. If E(F ) is an elliptic curve over a field F ,governedby the equation y 2 = x 3 + Cx 2 + Ax + B, andg isanonzeroelementofF , then the quadratic twist of E by g is the elliptic curve over F governed by the equation gy 2 = x 3 +Cx 2 +Ax+B. By a change of variables X = gx, Y = g 2 y, the Weierstrass form for this twist curve is Y 2 = X 3 + gCX 2 + g 2 AX + g 3 B. We shall find that in some contexts it will be useful to leave the curve in the form gy 2 = x 3 + Cx 2 + Ax + B, and in other contexts, we shall wish to use the equivalent Weierstrass form. An immediate observation is that if g, h are nonzero elements of the field F , then the quadratic twist of an elliptic curve by g gives a group isomorphic to the quadratic twist of the curve by gh 2 . (Indeed, just let a new variable Y be hy. To see that the groups are isomorphic, a simple check of the formulae involved suffices.) Thus, if Fq is a finite field, there is really only one quadratic twist of an elliptic curve E(Fq) that is different from the curve itself. This follows, since if g is not a square in Fq, thenash runs over the nonzero elements of Fq, gh 2 runs over all of the nonsquares. This unique nontrivial quadratic twist of E(Fq) is sometimes denoted by E ′ (Fq), especially when we are not particularly interested in which nonsquare is involved in the twist. Now for option (4), homogeneous coordinates with “Y ” dropped. We shall discuss this for a twist curve gy 2 = x 3 +Cx 2 +Ax+B; see Definition 7.2.5. We first develop the idea using affine coordinates. Suppose P1,P2 are affine points on an elliptic curve E(F )withP1 = ±P2. One can write down via Definition 7.1.2 (generalized for the presence of “g”) expressions for x+,x−, namely, the x-coordinates of P1 + P2 and P1 − P2, respectively. If these expressions are multiplied, one sees that the y-coordinates of P1,P2 appear only to even powers, and so may be replaced by x-expressions, using the defining curve gy 2 = x 3 + Cx 2 + Ax + B. Somewhat miraculously the resulting expression is subject to much cancellation, including the disappearance of the parameter g. The equations are stated in the following result from [Montgomery 1987, 1992a], though we generalize them here to a quadratic twist of any curve that is given by equation (7.5). Theorem 7.2.6 (Generalized Montgomery identities). Given an elliptic curve E determined by the cubic gy 2 = x 3 + Cx 2 + Ax + B, and two points P1 =(x1,y1), P2 =(x2,y2), neither being O, denote by x± respectively the x-coordinates of P1 ± P2. Then if x1 = x2, we have x+x− = (x1x2 − A) 2 − 4B(x1 + x2 + C) (x1 − x2) 2 ,
330 Chapter 7 ELLIPTIC CURVE ARITHMETIC whereas if x1 = x2 and 2P1 = O, we have x+ = (x2 1 − A) 2 − 4B(2x1 + C) 4(x 3 1 + Cx2 1 + Ax1 + B) . Note that g is irrelevant in the theorem, in the sense that the algebra for combining x-coordinates is independent of g; in fact, one would only use g if a particular starting y-coordinate were involved, but of course the main thrust of Montgomery parameterization is to ignore y-coordinates. We remind ourselves that the case C = 0 reduces to the ordinary Weierstrass form given by (7.4). However, as Montgomery noted, the case B = 0 is especially pleasant: For example, we have the simple relation x+x− = (x1x2 − A) 2 . (x1 − x2) 2 We shall see in what follows how this sort of relation leads to computationally efficient elliptic algebra. The idea is to use an addition chain to arrive at [n]P , where whenever we are to add two unequal points P1,P2, we happen to know already what P1 − P2 is. This magic is accomplished via the Lucas chain already discussed in Section 3.6.3. In the current notation, we will have at intermediate steps a pair [k]P, [k +1]P , and from this we shall form either the pair [2k]P, [2k +1]P or the pair [2k +1]P, [2k +2]P , depending on the bits of n. In either case, we perform one doubling and one addition. And for the addition, we already know the difference of the two points added, namely P itself. To avoid inversions, we adopt the homogeneous coordinates of option (2), but we drop the “Y ” coordinate. Since the coordinates are homogeneous, when we have the pair [X : Z], it is only the ratio X/Z that is determined (when Z = 0). The point at infinity is recognized as the pair [0 : 0]. Suppose we have points P1,P2 in homogeneous coordinates on an elliptic curve given by equation (7.5), and P1,P2 are not O, P1 = P2. If P1 =[X1,Y1,Z1], P2 =[X2,Y2,Z2], P1 + P2 =[X+,Y+,Z+], P1 − P2 =[X−,Y−,Z−], then on the basis of Theorem 7.2.6 it is straightforward to establish, in the case that X− = 0, that we may take X+ = Z− (X1X2 − AZ1Z2) 2 − 4B(X1Z2 + X2Z1 + CZ1Z2)Z1Z2 , (7.6) Z+ = X−(X1Z2 − X2Z1) 2 . These equations define the pair X+,Z+ as a function of the six quantities X1,Z1,X2, Z2,X−,Z−, withY1,Y2 being completely irrelevant. We denote this function by [X+ : Z+] =addh([X1 : Z1], [X2 : Z2], [X− : Z−]),
- Page 288 and 289: 278 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 290 and 291: 280 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 292 and 293: 282 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 294 and 295: 284 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 296 and 297: 286 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 298 and 299: 288 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 300 and 301: 290 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 302 and 303: 292 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 304 and 305: 294 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 306 and 307: 296 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 308 and 309: 298 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 310 and 311: 300 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 312 and 313: 302 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 314 and 315: 304 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 316 and 317: 306 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 318 and 319: 308 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 320 and 321: 310 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 322 and 323: 312 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 324 and 325: 314 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 326 and 327: 316 Chapter 6 SUBEXPONENTIAL FACTOR
- Page 328 and 329: Chapter 7 ELLIPTIC CURVE ARITHMETIC
- Page 330 and 331: 7.1 Elliptic curve fundamentals 321
- Page 332 and 333: 7.2 Elliptic arithmetic 323 the poi
- Page 334 and 335: 7.2 Elliptic arithmetic 325 with EC
- Page 336 and 337: 7.2 Elliptic arithmetic 327 Algorit
- Page 340 and 341: 7.2 Elliptic arithmetic 331 the “
- Page 342 and 343: 7.3 The theorems of Hasse, Deuring,
- Page 344 and 345: 7.4 Elliptic curve method 335 a ran
- Page 346 and 347: 7.4 Elliptic curve method 337 B1 =
- Page 348 and 349: 7.4 Elliptic curve method 339 facto
- Page 350 and 351: 7.4 Elliptic curve method 341 propa
- Page 352 and 353: 7.4 Elliptic curve method 343 As fo
- Page 354 and 355: 7.4 Elliptic curve method 345 if(1
- Page 356 and 357: 7.5 Counting points on elliptic cur
- Page 358 and 359: 7.5 Counting points on elliptic cur
- Page 360 and 361: 7.5 Counting points on elliptic cur
- Page 362 and 363: 7.5 Counting points on elliptic cur
- Page 364 and 365: 7.5 Counting points on elliptic cur
- Page 366 and 367: 7.5 Counting points on elliptic cur
- Page 368 and 369: 7.5 Counting points on elliptic cur
- Page 370 and 371: 7.5 Counting points on elliptic cur
- Page 372 and 373: 7.5 Counting points on elliptic cur
- Page 374 and 375: 7.5 Counting points on elliptic cur
- Page 376 and 377: 7.5 Counting points on elliptic cur
- Page 378 and 379: 7.6 Elliptic curve primality provin
- Page 380 and 381: 7.6 Elliptic curve primality provin
- Page 382 and 383: 7.6 Elliptic curve primality provin
- Page 384 and 385: 7.7 Exercises 375 7.4. As in Exerci
- Page 386 and 387: 7.7 Exercises 377 (some Bj equals A
330 Chapter 7 ELLIPTIC CURVE ARITHMETIC<br />
whereas if x1 = x2 and 2P1 = O, we have<br />
x+ = (x2 1 − A) 2 − 4B(2x1 + C)<br />
4(x 3 1 + Cx2 1 + Ax1 + B) .<br />
Note that g is irrelevant in the theorem, in the sense that the algebra for<br />
combining x-coordinates is independent of g; in fact, one would only use g if a<br />
particular starting y-coordinate were involved, but of course the main thrust of<br />
Montgomery parameterization is to ignore y-coordinates. We remind ourselves<br />
that the case C = 0 reduces to the ordinary Weierstrass form given by (7.4).<br />
However, as Montgomery noted, the case B = 0 is especially pleasant: For<br />
example, we have the simple relation<br />
x+x− = (x1x2 − A) 2<br />
.<br />
(x1 − x2) 2<br />
We shall see in what follows how this sort of relation leads to computationally<br />
efficient elliptic algebra.<br />
The idea is to use an addition chain to arrive at [n]P , where whenever<br />
we are to add two unequal points P1,P2, we happen to know already what<br />
P1 − P2 is. This magic is accomplished via the Lucas chain already discussed<br />
in Section 3.6.3. In the current notation, we will have at intermediate steps a<br />
pair [k]P, [k +1]P , and from this we shall form either the pair [2k]P, [2k +1]P<br />
or the pair [2k +1]P, [2k +2]P , depending on the bits of n. In either case,<br />
we perform one doubling and one addition. And for the addition, we already<br />
know the difference of the two points added, namely P itself.<br />
To avoid inversions, we adopt the homogeneous coordinates of option (2),<br />
but we drop the “Y ” coordinate. Since the coordinates are homogeneous, when<br />
we have the pair [X : Z], it is only the ratio X/Z that is determined (when<br />
Z = 0). The point at infinity is recognized as the pair [0 : 0]. Suppose we<br />
have points P1,P2 in homogeneous coordinates on an elliptic curve given by<br />
equation (7.5), and P1,P2 are not O, P1 = P2. If<br />
P1 =[X1,Y1,Z1], P2 =[X2,Y2,Z2],<br />
P1 + P2 =[X+,Y+,Z+], P1 − P2 =[X−,Y−,Z−],<br />
then on the basis of Theorem 7.2.6 it is straightforward to establish, in the<br />
case that X− = 0, that we may take<br />
<br />
X+ = Z− (X1X2 − AZ1Z2) 2 <br />
− 4B(X1Z2 + X2Z1 + CZ1Z2)Z1Z2 ,<br />
(7.6)<br />
Z+ = X−(X1Z2 − X2Z1) 2 .<br />
These equations define the pair X+,Z+ as a function of the six quantities<br />
X1,Z1,X2, Z2,X−,Z−, withY1,Y2 being completely irrelevant. We denote<br />
this function by<br />
[X+ : Z+] =addh([X1 : Z1], [X2 : Z2], [X− : Z−]),