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


C++ ECn2类代码示例

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


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

示例1: line

ZZn12 line(ECn2& A,ECn2& C,ECn2& B,ZZn2& slope,ZZn2& extra,BOOL Doubling,ZZn& Qx,ZZn& Qy)
{
    ZZn12 w;
    ZZn4 nn,dd;
    ZZn2 X,Y;

    ZZn2 Z3;

    C.getZ(Z3);

// Thanks to A. Menezes for pointing out this optimization...
    if (Doubling)
    {
        ZZn2 Z,ZZ;
        A.get(X,Y,Z);
        ZZ=Z; ZZ*=ZZ;
		nn.set((Z3*ZZ)*Qy,slope*X-extra);
		dd.set(-(ZZ*slope)*Qx);        
    }
    else
    {
        ZZn2 X2,Y2;
        B.get(X2,Y2);
		nn.set(Z3*Qy,slope*X2-Y2*Z3);
		dd.set(-slope*Qx);       
    }
    w.set(nn,dd);

    return w;
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:30,代码来源:bn_pair.cpp

示例2: mul

ECn2 mul(Big& a,ECn2& P,Big& b,ECn2& Q)
{
    ECn2 R;
    ecn2_mul2_jsf(a.getbig(),&(P.fn),b.getbig(),&(Q.fn),&(R.fn));
	R.norm();
    return R;
}
开发者ID:ferozsalam,项目名称:FYP,代码行数:7,代码来源:ecn2.cpp

示例3: q_power_frobenius

void q_power_frobenius(ECn2 &A,ZZn2 &F)
{ 
// Fast multiplication of A by q (for Trace-Zero group members only)
    ZZn2 x,y,z,w,r;

#ifdef AFFINE
    A.get(x,y);
#else
    A.get(x,y,z);
#endif

	w=F*F;
	r=F;

	if (get_mip()->TWIST==MR_SEXTIC_M) r=inverse(F);  // could be precalculated
	if (get_mip()->TWIST==MR_SEXTIC_D) r=F;

	w=r*r;
	x=w*conj(x);
	y=r*w*conj(y);

#ifdef AFFINE
    A.set(x,y);
#else
	z.conj();
    A.set(x,y,z);

#endif
}
开发者ID:stoneskill,项目名称:mix-O_AllWin,代码行数:29,代码来源:ake12bnx.cpp

示例4: line

ZZn12 line(ECn2& A,ECn2& C,ZZn2& slope,ZZn& Qx,ZZn& Qy)
{
     ZZn12 w;
     ZZn6 nn,dd;
     ZZn2 X,Y;

#ifdef AFFINE
     A.get(X,Y);

     dd.set(slope*Qx,Y-slope*X);
     nn.set((ZZn2)-Qy);
     w.set(nn,dd);

#endif
#ifdef PROJECTIVE
    ZZn2 Z,Z2,ZZ,ZZZ;

    A.get(X,Y,Z);
    C.getZ(Z2);

    ZZ=Z*Z;
    ZZZ=ZZ*Z;

    dd.set((ZZZ*slope)*Qx,Z2*Y-Z*X*slope);
    nn.set((ZZn2)-(ZZZ*Z2)*Qy);
    w.set(nn,dd);

#endif

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

示例5: HashG2

ECn2 HashG2(ECn2 &Qx0, Big &x, ZZn2 &X){
//vector=[ 1, 2, 4 ]
  ECn2 r;
  ECn2 xA;
  ECn2 xB;
  ECn2 xC;
  ECn2 t0;
  ECn2 Qx0_;
  ECn2 Qx1;
  ECn2 Qx1_;
  ECn2 Qx2;
  ECn2 Qx2_;
  ECn2 Qx3;
  ECn2 Qx3_;

  Qx0_=-(Qx0);
  Qx1=x*Qx0;
  Qx1_=-(Qx1);
  Qx2=x*Qx1;
  Qx2_=-(Qx2);
  Qx3=x*Qx2;
  Qx3_=-(Qx3);

  xA=Qx0;
  xB=Qx0;
  t0=xA+xB;
  xB=psi(Qx1,X,2);

  t0=t0+xB;
  t0+=t0;
  xB=Qx1_;
  xC=Qx2_;

  xB+=xC;
  xC=Qx3;
  xB+=xC;
  xC=psi(Qx0,X,1);
  xB+=xC;
  xC=psi(Qx1_,X,1);
  xB+=xC;
  xC=psi(Qx2_,X,1);
  xB+=xC;
  xC=psi(Qx3,X,1);
  xB+=xC;
  xC=psi(Qx0_,X,2);
  xB+=xC;
  xC=psi(Qx2_,X,2);
  xB+=xC;
  xB.norm();
  t0=t0+xB;

r=t0;
r.norm();
return r;

}
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:56,代码来源:ake12blsa.cpp

示例6: q_power_frobenius

void q_power_frobenius(ECn2 &A,ZZn2 &F)
{ 
// Fast multiplication of A by q (for Trace-Zero group members only)
    ZZn2 x,y,z,w,r;

// Faster method

#ifdef AFFINE
    A.get(x,y);
#else
    A.get(x,y,z);
#endif

	w=F*F;
	r=F;

    x=w*conj(x);
    y=r*w*conj(y);

#ifdef AFFINE
    A.set(x,y);
#else
    z=conj(z);
    A.set(x,y,z);
#endif


/*

// First "untwist" the point A to (X,Y) where X,Y in F_p^{12}
    A.get(x,y);
    h.clear();
    l.set1(x);
    X.set(l,h);

    l.clear();
    h.set1(y);
    Y.set(l,h);

// Apply the Frobenius..

    X.powq(F);
    Y.powq(F);

// Now "twist" it back to A

    X.get(l,h);
    l.get1(x);

    Y.get(l,h);
    h.get1(y);

    A.set(x,y);

*/
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:56,代码来源:ake12bnr.cpp

示例7: g

ZZn4 g(ECn2& A,ECn2& B,ZZn& Qx,ZZn& Qy)
{
    ZZn2  lam;
    ECn2 P=A;

// Evaluate line from A
    A.add(B,lam);
    if (A.iszero())   return (ZZn4)1; 

    return line(P,lam,Qx,Qy);
}
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:11,代码来源:hess4.cpp

示例8: q_power_frobenius

void q_power_frobenius(ECn2 &A,ZZn2 &F)
{ 
    ZZn2 x,y,z,w,r;

    A.get(x,y,z);
	w=F*F;
	r=F;
    x=w*conj(x);
    y=r*w*conj(y);
	z.conj();
    A.set(x,y,z);
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:12,代码来源:bn_pair.cpp

示例9: g

ZZn12 g(ECn2& A,ECn2& B,ZZn& Qx,ZZn& Qy)
{
    ZZn2 lam,extra;
    ZZn12 r;
    ECn2 P=A;
    BOOL Doubling;

// Evaluate line from A
    Doubling=A.add(B,lam,extra);

    if (A.iszero())   return (ZZn12)1; 
    r=line(P,A,B,lam,extra,Doubling,Qx,Qy);

    return r;
}
开发者ID:stoneskill,项目名称:mix-O_AllWin,代码行数:15,代码来源:ake12bnx.cpp

示例10: hash_and_map2

ECn2 hash_and_map2(char *ID)
{
    int i;
    ECn2 S;
    ZZn2 X;
    Big x0=H1(ID);

    forever
    {
        x0+=1;
        X.set((ZZn)1,(ZZn)x0);
        if (!S.set(X)) continue;
        break;
    }
    return S;
}     
开发者ID:stoneskill,项目名称:mix-O_AllWin,代码行数:16,代码来源:ake12bnx.cpp

示例11: g

ZZn12 g(ECn2& A,ECn2& B,ZZn& Qx,ZZn& Qy)
{
    ZZn2 lam;
    ZZn12 r;
    ECn2 P=A;
 //   int fpcb=fpc;

// Evaluate line from A
    A.add(B,lam);
//cout << "point addition/doubling= " << fpc-fpcb << endl;
    if (A.iszero())   return (ZZn12)1; 
//fpcb=fpc;
    r=line(P,A,lam,Qx,Qy);
//cout << "line calculation= " << fpc-fpcb << endl;
//cout << "r= " << r << endl;
    return r;
}
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:17,代码来源:ake12bna.cpp

示例12: mul4

ECn2 mul4(ECn2* P,const Big* b)
{
    int i,n=4;
	ECn2 R;
	big x[4];
	ecn2 p[4];
    
    for (i=0;i<n;i++)
	{
		x[i]=b[i].getbig();
		p[i]=P[i].fn;
	}

	ecn2_mult4(x,p,&(R.fn));

	R.norm();
	return R;
}
开发者ID:BingyZhang,项目名称:CommutEnc,代码行数:18,代码来源:ecn2.cpp

示例13: hash2

ECn2 hash2(char *ID,Big cof2)
{
    ECn2 T;
    ZZn2 x;
    Big x0,y0=0;

    x0=H1(ID);
    do
    {
        x.set(x0,y0);
        x0+=1;
    }
    while (!is_on_curve(x));
    T.set(x);
    T*=cof2;

    return T;
}     
开发者ID:CodeMason,项目名称:skype_part3_source,代码行数:18,代码来源:hess4.cpp

示例14: hash2

ECn2 hash2(char *ID)
{
    ECn2 T;
    ZZn2 x;
    Big x0,y0=0;

    x0=H1(ID);
    do
    {
        x.set(x0,y0);
        x0+=1;
    }
    while (!is_on_curve(x));
    T.set(x);

// cout << "T= " << T << endl;

    return T;
}     
开发者ID:ferozsalam,项目名称:FYP,代码行数:19,代码来源:ake4mntt.cpp

示例15: hash_and_map2

ECn2 hash_and_map2(char *ID)
{
    int i;
    ECn2 S;
    ZZn2 X;
 
    Big x0=H1(ID);

    forever
    {
        x0+=1;
        X.set((ZZn)0,(ZZn)x0);
//cout << "X= " << X << endl;
        if (!S.set(X)) continue;
        break;
    }
  
//    cout << "S= " << S << endl;
    return S;
}     
开发者ID:J0s3f,项目名称:FiSH-irssi,代码行数:20,代码来源:ake12bna.cpp


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