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_FpXQE(GEN a4, GEN a6, GEN T, GEN p)
{
  pari_sp ltop = avma;
  GEN x, x2, y, rhs;
  long v = get_FpX_var(T), d = get_FpX_degree(T);
  do
  {
    avma= ltop;
    x   = random_FpX(d,v,p); 
    x2  = FpXQ_sqr(x, T, p);
    rhs = FpX_add(FpXQ_mul(x, FpX_add(x2, a4, p), T, p), a6, p);
  } while ((!signe(rhs) && !signe(FpX_add(FpX_mulu(x2,3,p), a4, p)))
          || !FpXQ_issquare(rhs, T, p));
  y = FpXQ_sqrt(rhs, T, p);
  if (!y) pari_err_PRIME("random_FpE", p);
  return gerepilecopy(ltop, mkvec2(x, y));
}
GEN random_FpXQE ( GEN a4 , GEN a6 , GEN T , GEN p ) { pari_sp ltop = avma ; GEN x , x2 , y , rhs ; long v = get_FpX_var ( T ) , d = get_FpX_degree ( T ) ; do { avma = ltop ; x = random_FpX ( d , v , p ) ; x2 = FpXQ_sqr ( x , T , p ) ; rhs = FpX_add ( FpXQ_mul ( x , FpX_add ( x2 , a4 , p ) , T , p ) , a6 , p ) ; } while ( ( ! signe ( rhs ) && ! signe ( FpX_add ( FpX_mulu ( x2 , 3 , p ) , a4 , p ) ) ) || ! FpXQ_issquare ( rhs , T , p ) ) ; y = FpXQ_sqrt ( rhs , T , 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  */