Exemplo n.º 1
0
ZZn6 line(ECn3& A,ECn3& C,ECn3& B,int type,ZZn3& slope,ZZn3& ex1,ZZn3& ex2,ZZn& Px,ZZn& Py)
{
    ZZn6 w;
	ZZn3 d;
#ifdef AFFINE
    ZZn3 x,y;
    A.get(x,y);
    d.set1(Py);
	w=shuffle(y-slope*(Px+x),d);

#endif
#ifdef PROJECTIVE
	ZZn3 x,y,z,z3,t;
	C.getZ(z3);
	d.set1(Py);

	if (type==MR_ADD)
	{ // exploit that B is in affine
		ZZn3 x2,y2;
		B.get(x2,y2);
		y2*=z3; d*=z3; 
		w=shuffle(y2-slope*(Px+x2),d);
	}
	if (type==MR_DOUBLE)
	{ // use extra information from point doubling
		A.get(x,y,z);
		w=shuffle(ex1-slope*(Px*ex2+x),d*z3*ex2);	
	}
#endif

    return w;
}
Exemplo n.º 2
0
ZZn6 gp(ZZn3* ptable,int &j,ZZn& Px,ZZn& Py)
{
	ZZn6 w;
	ZZn3 d;
	d.set1(Py);
	w=shuffle(ptable[j]*Px+ptable[j+1],d);
	j+=2;
	return w;
}