bridge/class-master/depend/pari/src/basemath/FpE.c
/* Finds a random non-singular point on E */
Finds a random non-singular point on E
Finds a random non - singular point on E
GEN
random_FpE(GEN a4, GEN a6, GEN p)
{
  pari_sp ltop = avma;
  GEN x, x2, y, rhs;
  do
  {
    avma= ltop;
    x   = randomi(p); 
    x2  = Fp_sqr(x, p);
    rhs = Fp_add(Fp_mul(x, Fp_add(x2, a4, p), p), a6, p);
  } while ((!signe(rhs) && !signe(Fp_add(Fp_mulu(x2,3,p),a4,p)))
          || kronecker(rhs, p) < 0);
  y = Fp_sqrt(rhs, p);
  if (!y) pari_err_PRIME("random_FpE", p);
  return gerepilecopy(ltop, mkvec2(x, y));
}
GEN random_FpE ( GEN a4 , GEN a6 , GEN p ) { pari_sp ltop = avma ; GEN x , x2 , y , rhs ; do { avma = ltop ; x = randomi ( p ) ; x2 = Fp_sqr ( x , p ) ; rhs = Fp_add ( Fp_mul ( x , Fp_add ( x2 , a4 , p ) , p ) , a6 , p ) ; } while ( ( ! signe ( rhs ) && ! signe ( Fp_add ( Fp_mulu ( x2 , 3 , p ) , a4 , p ) ) ) || kronecker ( rhs , p ) < 0 ) ; y = Fp_sqrt ( rhs , p ) ; if ( ! y ) pari_err_PRIME ( " " , p ) ; return gerepilecopy ( ltop , mkvec2 ( x , y ) ) ; }
Finds a random non-singular point on E
Finds a random non - singular point on E
/*  x^3+a4*x+a6 = x*(x^2+a4)+a6  */