]> Programming ECC - Hilbert Class Polynomials

Programming ECC

These require floating point arithmetic to compute [Cohen p415, BSS p151]. Routines for complex numbers need to be written. For multiplication, using a trick similar to Karatsuba multiplication (a+bi)(c+di)=acbd+((a+b)(c+d)acbd)i saves one multiplication. Similarly, for squaring, one should use (a+bi) 2 =(a+b)(ab)+2 abi if multiplication is sufficiently less efficient than addition or subtraction.

To minimize the possbility of underflow, overflow or precision loss, the complex modulus of a+bi should be computed as [Numerical Recipes, 5.4] a+ib={a1 +(b/a) 2 ab b1 +(a/b) 2 a<b Similarly, division should be implemented as a+ibc+id={(a+b(d/c))+i(ba(d/c))c+d(d/c) cd (a(c/d)+b)+i(b(c/d)a)c(c/d)+d c<d

We will need to compute the function j(τ) for τ in the upper complex plane. Set q=e 2 iπτ. Define Δ(τ)=q(1 + n1 (1 ) n(q n(3 n2 )/2 +q n(3 n+1 )/2 )) 24 Then compute j(τ)=(256 f(τ)+1 ) 3 f(τ) where f(τ)=Δ(2 τ)Δ(τ)

The Hilbert class polynomial for the discriminant D is given by H D(x)=(xj(α)) where α runs over all complex numbers such that α=b+D2 a where ax 2 +bxy+cy 2 is a primitive reduced positive definite binary quadratic form of discriminant D. In other words, b 2 4 ac=D, baD/3 , ac, gcd(a,b,c)=1 and if b=a or a=c then b0 .

Thus H D(x) can be computed by the following procedure. Let P be a polynomial variable. Assume D is 0 or 1 mod4 .

  1. Set P=1 ,b=Dmod2 ,B=D/3
  2. Set t=(b 2 +D)/4 and a=max(b,1 )
  3. If a does not divide t go to the next step. Otherwise compute j=j((b+D)/(2 a)). If a=b or a 2 =t or b=0 set P=P(Xj) otherwise set P=P(X 2 2 (j)X+j 2 ).
  4. Set a=a+1 . If a 2 t go to the previous step.
  5. Set b=b+2 . If bB go to step 2, otherwise round the coefficients of P to the nearest integer and output P.