本文整理汇总了C++中ECn2::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ECn2::get方法的具体用法?C++ ECn2::get怎么用?C++ ECn2::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ECn2
的用法示例。
在下文中一共展示了ECn2::get方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: 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
}
示例3: 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;
}
示例4: 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);
*/
}
示例5: 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);
}
示例6: line
ZZn12 line(ECn2& A,ECn2& C,ECn2&B,ZZn2& slope,ZZn2& extra,BOOL Doubling,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 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;
dd.set(-(ZZ*slope)*Qx,slope*X-extra);
nn.set((Z3*ZZ)*Qy);
}
else
{
ZZn2 X2,Y2;
B.get(X2,Y2);
dd.set(-slope*Qx,slope*X2-Y2*Z3);
nn.set(Z3*Qy);
}
w.set(nn,dd);
#endif
//cout << "w= " << w << endl;
return w;
}
示例7: 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;
x=w*conj(x);
y=r*w*conj(y);
#ifdef AFFINE
A.set(x,y);
#else
z.conj();
A.set(x,y,z);
#endif
}
示例8: cofactor
void cofactor(ECn2& S,ZZn2 &F,Big& t)
{
ZZn2 x,y,w,z;
ECn2 K,T;
K=S;
z=F;
w=F*F;
S.get(x,y);
x=w*conj(x);
y=z*w*conj(y);
S.set(x,y);
x=w*conj(x);
y=z*w*conj(y);
T.set(x,y);
S+=K;
S*=t;
S-=T;
S-=K;
S.norm();
}
示例9: line
ZZn12 line(ECn2& A,ECn2& C,ECn2& B,ZZn2& slope,ZZn2& extra,BOOL Doubling,ZZn& Qx,ZZn& Qy)
{
ZZn12 w;
ZZn4 nn,dd,cc;
ZZn2 X,Y;
#ifdef AFFINE
A.get(X,Y);
if (get_mip()->TWIST==MR_SEXTIC_M)
{
nn.set(txx((ZZn2)-Qy),Y-slope*X);
cc.seth(slope*Qx);
}
if (get_mip()->TWIST==MR_SEXTIC_D)
{
nn.set((ZZn2)-Qy,Y-slope*X);
dd.set(slope*Qx);
}
w.set(nn,dd,cc);
#endif
#ifdef PROJECTIVE
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;
if (get_mip()->TWIST==MR_SEXTIC_M)
{ // "multiplied across" by i to simplify
nn.set((Z3*ZZ)*txx((ZZn2)Qy),slope*X-extra);
cc.seth(-(ZZ*slope)*Qx);
}
if (get_mip()->TWIST==MR_SEXTIC_D)
{
nn.set((Z3*ZZ)*Qy,slope*X-extra);
dd.set(-(ZZ*slope)*Qx);
}
}
else
{
ZZn2 X2,Y2;
B.get(X2,Y2);
if (get_mip()->TWIST==MR_SEXTIC_M)
{
nn.set(Z3*txx((ZZn2)Qy),slope*X2-Y2*Z3);
cc.seth(-slope*Qx);
}
if (get_mip()->TWIST==MR_SEXTIC_D)
{
nn.set(Z3*Qy,slope*X2-Y2*Z3);
dd.set(-slope*Qx);
}
}
w.set(nn,dd,cc);
#endif
return w;
}
示例10: untwist
void untwist(ECn2& P,ZZn2& U,ZZn2& V)
{
P.get(U,V);
U=-tx(U)/2;
V=-V/2;
}
示例11: main
//.........这里部分代码省略.........
Q=(p-1+t)*Q; // generator point in G2
cru=(18*pow(x,3)-18*x*x+9*x-2);
}
if (strcmp(curvename,"BLS383")==0)
{
curve=20;
printf("Curve= BLS383\n");
strcpy(fieldname,curvename);
mbits=383;
words=(1+((mbits-1)/bb));
curvetype=WEIERSTRASS;
modtype=NOT_SPECIAL;
curve_a=0;
mip->IOBASE=16;
// x=(char *)"11000001000000040";
x=(char *)"10008000001001200"; // SIGN_OF_X is POSITIVE
p=(pow(x,6)-2*pow(x,5)+2*pow(x,3)+x+1)/3;
t=x+1;
r=pow(x,4)-x*x+1;
cof=(p+1-t)/r;
// gx=-2; gy=-1;
// curve_b=9;
gx=1; gy=4;
curve_b=15;
ecurve((Big)0,curve_b,p,MR_AFFINE);
// mip->TWIST=MR_SEXTIC_D;
mip->TWIST=MR_SEXTIC_M;
P.set(gx,gy);
P*=cof;
P.get(gx,gy);
//cout << "gx= " << gx << endl;
//cout << "gy= " << gy << endl;
//cout << "y^2= " << (gy*gy)%p << endl;
//cout << "x^3+b= " << (gx*gx*gx+15)%p << endl;
//while (!Q.set(randn2())) ; // probably not best way to choose this
Xa=1;
while (!Q.set(Xa))
{
Xa=Xa+(ZZn2)1;
}
TT=t*t-2*p;
PP=p*p;
FF=sqrt((4*PP-TT*TT)/3);
np=PP+1-(-3*FF+TT)/2; // 2 possibilities...
Q=(np/r)*Q;
zcru=pow((ZZn)2,(p-1)/3);
// zcru*=zcru; // right cube root of unity
cru=(Big)zcru;
}
if (strcmp(curvename,"BLS381")==0)
{
curve=21;
printf("Curve= BLS381\n");
strcpy(fieldname,curvename);
mbits=381;
示例12: tate
BOOL tate(ECn& P,ECn2 Q,Big& q,ZZn2 &Fr,Big cof,ZZn2& r)
{
int i,j,n,nb,nbw,nzs;
ECn A,P2,t[8];
ZZn4 w,hc,z2n,zn[8],res;
ZZn2 Qx,Qy;
#ifdef MR_COUNT_OPS
fpc=fpa=fpx=0;
#endif
Q.get(Qx,Qy);
Qx=txd(Qx);
Qy=txd(txd(Qy));
normalise(P);
res=zn[0]=1;
t[0]=P2=A=P;
z2n=g(P2,P2,Qx,Qy); // P2=P+P
normalise(P2);
//
// Build windowing table
//
for (i=1;i<8;i++)
{
hc=g(A,P2,Qx,Qy);
t[i]=A;
zn[i]=z2n*zn[i-1]*hc;
}
multi_norm(8,t); // make t points Affine
A=P;
nb=bits(q);
for (i=nb-2;i>=0;i-=(nbw+nzs))
{
n=window(q,i,&nbw,&nzs,4); // standard MIRACL windowing
for (j=0;j<nbw;j++)
{
res*=res;
res*=g(A,A,Qx,Qy);
}
if (n>0)
{
res*=zn[n/2];
res*=g(A,t[n/2],Qx,Qy);
}
for (j=0;j<nzs;j++)
{
res*=res;
res*=g(A,A,Qx,Qy);
}
}
if (!A.iszero()) return FALSE;
#ifdef MR_COUNT_OPS
printf("After Miller fpc= %d fpa= %d fpx= %d\n",fpc,fpa,fpx);
fpa=fpc=fpx=0;
#endif
w=res;
w.powq(Fr); w.powq(Fr); // ^(p^2-1)
res=w/res;
res.mark_as_unitary();
res*=res; w=res; res*=res; res*=res; res*=res; res*=res; res*=w; // res=powu(res,34);
w=res;
res.powq(Fr);
res*=powu(w,cof);
#ifdef MR_COUNT_OPS
printf("After Final exp. fpc= %d fpa= %d fpx= %d\n",fpc,fpa,fpx);
fpa=fpc=fpx=0;
#endif
r=real(res);
if (r.isunity()) return FALSE;
return TRUE;
}
示例13: cofactor
void cofactor(ECn2& S,ZZn2 &F,Big& t)
{
ZZn2 x,y,w,z;
ZZn6 h,l,W;
ECn2 K,T;
K=S;
z=F;
w=F*F;
S.get(x,y);
x=w*conj(x);
y=z*w*conj(y);
S.set(x,y);
x=w*conj(x);
y=z*w*conj(y);
T.set(x,y);
S+=K;
S*=t;
S-=T;
S-=K;
S.norm();
// First "untwist" the point A to (X,Y) where X,Y in F_p^{12}
/*
K=S;
ZZn12 X,Y,X2,Y2;
S.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);
X2=X; X2.powq(F);
Y2=Y; Y2.powq(F);
// Now "twist" it back to S
X.get(l,h);
l.get1(x);
Y.get(l,h);
h.get1(y);
S.set(x,y);
// untwist unto T
X2.get(l,h);
l.get1(x);
Y2.get(l,h);
h.get1(y);
T.set(x,y);
S+=K;
S*=t;
S-=T;
S-=K;
*/
}