コード例 #1
0
ファイル: test.cpp プロジェクト: lhlich/pairing
void makepoint(point &P, apint &a,apint &b){

	if(!LIGHT){
		P=P.x.a*g0;
		return;

	}
	
	apint sq=getQ().p+apint(1);	
	//cout<<sq<<","<<(sq>>2);
	//cout<<sq<<endl;
//	cout<<"making point...";	
	
	P.y = P.x.pow(apint(3)) + P.x;
	P.y = P.y.pow(sq>>2);

	complex one(apint(1), apint(0), 1);

	if (!P.on_curve()){
	//	cout<<"failed :/"<<endl;
		P.x = P.x*complex(b,apint(0),1);
		P.x = P.x+complex(a,apint(0),1);
		makepoint(P,a,b);
	}	

}
コード例 #2
0
ファイル: test.cpp プロジェクト: lhlich/pairing
void load_g0(){
	if(LIGHT) return;

//153bit xval
	const char *xval="666285918909156579706577334448298316724907370077532163720911308141035224473899144233063713796722357570360597511749588023079703454150583408697678496165580";
//154bit yval

	const char* yval="8170329682717850087747595207221033944095934190074401412696905443236301073028440609121153197353941845696205713082179610663617373612405424702056538740290597";
	
	apint x=apint(0);
	apint y=apint(0);

	apint ten(10);
	int i;
	
	cout<<"loading x for g0: ";
	for(i=0;i<153;i++){
		x=x*ten;
		x=x+apint(xval[i]-'0');
		cout<<xval[i];
	}
	cout<<endl;

	cout<<"loading y for g0: ";
	for(i=0;i<154;i++){
		y=y*ten;
		y=y+apint(yval[i]-'0');
		cout<<yval[i];
	}
cout<<endl;
	g0.x=complex(x,apint(0),1);
	g0.y=complex(y,apint(0),1);

	if(!g0.on_curve())
		cout<<"WTF!"<<endl;
	
}