当前位置: 首页>>代码示例>>C++>>正文


C++ ECn::set方法代码示例

本文整理汇总了C++中ECn::set方法的典型用法代码示例。如果您正苦于以下问题:C++ ECn::set方法的具体用法?C++ ECn::set怎么用?C++ ECn::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ECn的用法示例。


在下文中一共展示了ECn::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: map_to_point

ECn map_to_point(char *ID)
{
    ECn Q;
    Big x0=H1(ID);
 
    if (is_on_curve(x0)) Q.set(x0);
    else                 Q.set(-x0);

    return Q;
}
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:10,代码来源:ibe_exp.cpp

示例2: memcpy

ECn 
charToECn (char *c, int *totLen)
{
  ECn e;
  Big x,y;
  int len = 0;
  char *orig = c;
  //   format: 4 bytes length, followed by the big

  memcpy (&len, c, sizeof (int));
  c += sizeof (int);
  x = from_binary (len, c);
  c += len;
  //  cout << "Len1 " << len << " x " << x;

  memcpy (&len, c, sizeof (int));
  c += sizeof (int);
  y = from_binary (len, c);
  c += len;
  //  cout << " Len2 " << len << " y " << y << "\n";

  e.set (x, y);

  *totLen = c - orig;
  return e;
}
开发者ID:ferozsalam,项目名称:FYP,代码行数:26,代码来源:proxylib_utilities.cpp

示例3: hash_and_map

ECn hash_and_map(char *ID)
{
    ECn Q;
    Big x0=H1(ID);

    while (!Q.set(x0,x0)) x0+=1;
    return Q;
}
开发者ID:karllen,项目名称:Windows_Program,代码行数:8,代码来源:AKE6.CPP

示例4: hash_and_map

ECn hash_and_map(char *ID,Big cof)
{
    ECn Q;
    Big x0=H1(ID);

    while (!Q.set(x0)) x0+=1;
    Q*=cof;
    return Q;
}
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:9,代码来源:ake1kmt.cpp

示例5: hash_and_map

ECn hash_and_map(char *ID,int len)
{
    ECn Q;
    Big x0=H1(ID,len);

    while (!Q.set(x0,x0)) x0+=1;
    Q*=CF;
    return Q;
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:9,代码来源:bls_sign.cpp

示例6: map_to_point

ECn map_to_point(char *ID)
{
    ECn Q;
    Big x0=H1(ID);
 
    while (!Q.set(x0,x0)) x0=x0+1;

    return Q;
}
开发者ID:karllen,项目名称:Windows_Program,代码行数:9,代码来源:IBE_EXP.CPP

示例7: map_to_point

ECn map_to_point(char *ID)
{
    ECn Q;
    Big x0,y0=H1(ID);
    x0=getx(y0);

    Q.set(x0,y0);

    return Q;
}
开发者ID:ferozsalam,项目名称:FYP,代码行数:10,代码来源:proxylib_utilities.cpp

示例8: map_f

ECn map_f(ECn& P,ZZn& zeta)
{
    ECn R;
    Big x,y;
    P.get(x,y);
    ZZn X=x;
    X=zeta*X; x=Big(X);
    if (!R.set(x,y)) cout << "something wrong in map_f" << endl;   
    return R;
}
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:10,代码来源:ake1kmt.cpp

示例9: Hash

ECn Hash(char *ID)
{
    ECn T;
    Big a=H1(ID);

    while (!is_on_curve(a)) a+=1;
    T.set(a);  // Make sure its on E(F_p)

    return T;
}     
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:10,代码来源:ake2sst.cpp

示例10: hash_and_map

ECn hash_and_map(char *ID,Big cof)
{
    ECn Q;
    Big x0=H1(ID);

    while (!is_on_curve(x0)) x0+=1;
    Q.set(x0);  // Make sure its on E(F_p)

    Q*=cof;
    return Q;
}
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:11,代码来源:hess4.cpp

示例11: hash_and_map

ECn hash_and_map(char *ID,int len)
{
    ECn Q;
    Big x0=H1(ID,len);
// jacobi tests
    while (!is_on_curve(x0)) x0+=1;
// one modular square root
    Q.set(x0);
    Q*=CF;
    return Q;
}
开发者ID:JacobBarthelmeh,项目名称:supercop,代码行数:11,代码来源:bls.cpp

示例12: hash_and_map

ECn hash_and_map(char *ID,Big cof)
{
    ECn T;
    Big a=H1(ID);

    while (!is_on_curve(a)) a+=1;
    T.set(a);

    T*=cof;

    return T;
}
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:12,代码来源:ake2sst.cpp

示例13: ecn_from_string

ECn CvSakke::ecn_from_string( const String& str )
{
	ECn result;
	
	size_t pos = str.find(",");

	if ( pos == String::npos )
		return result;
	
	Big x, y;
	
	String decoded;
	CvBase64::Decode( str.substr( 1, pos-1 ), decoded );
	x = from_binary( (int)decoded.size(), (char*)decoded.data() );
	
	decoded.clear();
	CvBase64::Decode( str.substr( pos+1, BN_BYTES ), decoded );	
	y = from_binary( (int)decoded.size(), (char*)decoded.data() );
	
	result.set( x, y );
	
	return result;
}
开发者ID:apache,项目名称:incubator-milagro-mfa-sdk-core,代码行数:23,代码来源:CvSakke.cpp

示例14: main


//.........这里部分代码省略.........
		p=pow((Big)2,mbits)-pow((Big)2,32)-977;  // Modulus
		mip->IOBASE=16;
		r=(char *)"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141";   // group order

		curve_b=(char *)"7";  // curve B parameter
		gx=(char *)"79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798";       // generator point
		gy=(char *)"483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8";
	}


	if (strcmp(curvename,"BN254")==0)
	{
		curve=18;
		printf("Curve= BN254\n");
		strcpy(fieldname,curvename);
		mbits=254;
		words=(1+((mbits-1)/bb));
		curvetype=WEIERSTRASS;
		modtype=NOT_SPECIAL;
		curve_a=0;
		mip->IOBASE=16;
		x=(char *)"4080000000000001";    // Fast but not GT_STRONG parameter

		p=36*pow(x,4)-36*pow(x,3)+24*x*x-6*x+1;  // Modulus
		t=6*x*x+1;
		r=p+1-t;                       // Group order
		curve_b=2;
		gx=p-1;                        // generator point in G1
		gy=1;
		cof=1;
		ecurve((Big)0,curve_b,p,MR_AFFINE);
		mip->TWIST=MR_SEXTIC_D;        // twist type

		Xa.set((ZZn)0,(ZZn)-1);
		Ya.set((ZZn)1,ZZn(0));
		Q.set(Xa,Ya);

		Q=(p-1+t)*Q;                   // generator point in G2
		cru=(18*pow(x,3)-18*x*x+9*x-2); // cube root of unity for GLV method
	}


	if (strcmp(curvename,"BN254CX")==0)
	{
		curve=19;
		printf("Curve= BN254CX\n");
		strcpy(fieldname,curvename);
		mbits=254;
		words=(1+((mbits-1)/bb));
		curvetype=WEIERSTRASS;
		modtype=NOT_SPECIAL;
		curve_a=0;
		mip->IOBASE=16;
		x=(char *)"4000000003C012B1";

		p=36*pow(x,4)-36*pow(x,3)+24*x*x-6*x+1;
		t=6*x*x+1;
		r=p+1-t;
		curve_b=2;
		gx=p-1;
		gy=1;
		cof=1;
		ecurve((Big)0,curve_b,p,MR_AFFINE);
		mip->TWIST=MR_SEXTIC_D;

		Xa.set((ZZn)0,(ZZn)-1);
开发者ID:apache,项目名称:incubator-milagro-crypto,代码行数:67,代码来源:romgen.cpp

示例15: main

int main()
{
	miracl *mip=&precision;
	Big s,x,q,p,t,A,B,cf,X,Y,sru,n,best_s,f,tau[5],TAU;
	Big T,P,F,m1,m2,m3,m4;
	BOOL got_one;
	ECn W;
	ECn4 Q;
	ZZn4 XX,YY,r;	
	ZZn2 xi;
	int i,ns,sign,best_ham=1000;
	mip->IOBASE=16;
	s="E000000000000000";   

	ns=1;
	
	forever
	{
		s+=1;
		for (sign=1;sign<=2;sign++)
		{

			if (sign==1) x=s;
			else         x=-s;

			if (x<0 || ham(x)>7) continue; // filter out difficult or poor solutions

			t=1+x;
			p=1+x+x*x-pow(x,4)+2*pow(x,5)-pow(x,6)+pow(x,8)-2*pow(x,9)+pow(x,10);
			q=1-pow(x,4)+pow(x,8);
	
			if (p%3!=0) continue;
			p/=3;
			
			if (p%8==1) continue;
			if (!prime(p)) continue;
			if (!prime(q)) continue;

			modulo(p);
			if (p%8==5) xi.set(0,1);
			if (p%8==3) xi.set(1,1);
			if (p%8==7) xi.set(2,1);

// make sure its irreducible
			if (pow(xi,(p*p-1)/2)==1) {/*cout << "Failed - not a square" << endl; */ continue;}
			if (pow(xi,(p*p-1)/3)==1) {/*cout << "Failed - not a cube" << endl; */ continue;}  // make sure that x^6-c is irreducible

			n=p+1-t;
			cf=n/q;

			tau[0]=2;  // count points on twist over extension p^4
			tau[1]=t;
			for (i=1;i<4;i++ ) tau[i+1]=t*tau[i]-p*tau[i-1];
			P=p*p*p*p;
			TAU=tau[4];

			F=(4*P-TAU*TAU)/3;
			F=sqrt(F);
		
			m2=P+1-(3*F+TAU)/2;

		//	cout << "m2%q= " << m2%q << endl;

			B=1;   // find curve equation
	
			forever
			{
				B+=1;
				if (B==2)
				{
					X=-1; Y=1;
				}
				else if (B==3)
				{
					X=1; Y=2;
				}
				else if (B==8)
				{
					X=1; Y=3;
				}
				else if (B==15)
				{
					X=1; Y=4;
				}
				else
				{
					do
					{
						X=rand(p);
						Y=sqrt(X*X*X+B,p);
					} while (Y==0);
				}
        
				ecurve(0,B,p,MR_AFFINE);
				W.set(X,Y);
				W*=cf;
				if ((q*W).iszero()) break;
			}

			mip->TWIST=MR_SEXTIC_M;  // is it an M-type twist...?
//.........这里部分代码省略.........
开发者ID:asgene,项目名称:sm2,代码行数:101,代码来源:bls24.cpp


注:本文中的ECn::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。