Contact Us!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

| Download
Views: 35
u=-(2^62 + 2^55 +1) p=36*u^4+36*u^3+24*u^2+6*u+1 r=36*u^4+36*u^3+18*u^2+6*u+1 t=6*u^2+1 #-------------- Fp-------------- Fp=GF(p) #------------------------------- b=2 #--------------Fp^2-------------- K2.<i>=PolynomialRing(Fp) Fp2.<i>=FiniteField(p^2,modulus=i^2+1) #------------------------------------ #-------------Fp^6--------------------- K6.<v>=PolynomialRing(Fp2) Fp6.<v>=Fp2.extension(v^3-i-1) #------------------------------------- #---------------Fp^12------------------- K12.<z>=PolynomialRing(Fp6) Fp12.<z>=Fp6.extension(z^2-v) Fp12.is_field=lambda:True #---------------------------------------
f1=Fp12.random_element()
Error in lines 1-1 Traceback (most recent call last): File "/cocalc/lib/python3.11/site-packages/smc_sagews/sage_server.py", line 1250, in execute exec( File "", line 1, in <module> NameError: name 'Fp12' is not defined
f=(f1^(p^6-1))^(p^2+1)
#algorithm 7: New variant of Devegili et al. def algorithm_7 (f,u): t0=f^(-2*u) t1=t0^2 t0=t0*t1 t1=f^(-1) t1=t0*t1 t2=(t1)^p t1=t1^2 t1=t1*t2 t2=t0^(-u) t0=t2^2 t0=t0^p t1=t1*t0 t2=t2*f t0=t2^(p^2) t1=t0*t1 t0=t2^(-6*u-5) t1=t1*t0 t0=t0^p t1=t1*t0 t0=f^2 t2=t0^2 t2=t2*f t1=t2*t1 t2=t2*t0 t2=t2^p t1=t1*t2 t2=f^(p^3) t1=t1*t2 return t1
algorithm_7 (f,u)==f^((p^4-p^2+1)/r)
True
#algorithm 8 : precomputations for new addition chain t0=f^(-u) y3=t0^2 y0=t0*y3 y2=y3^p y2=y3*y2 y2=y2^2 y2=y2*y3 t0=y0^(-u) y0=f^(-1) y1=t0^(p^2) y1=y0*y1 t0=t0^(-1) y3=t0^p y3=t0*y3 t0=t0^2 y1=t0*y1 t0=y3^(-u) t0=t0^2 t0=t0^(-1) y3=t0*y3 t0=f^p y0=f^(p^2) y0=t0*y0 t0=f^(p^3) y0=t0*y0
y0==f^p*f^(p^2)*f^(p^3)
True
y1==(f^(3*u^2))^(p^2)*f^(-1)*f^(-6*u^2)
True
y2==(f^p*f)^(-4*u)*f^(-2*u)
True
y3==(f^p*f)^(-6*u^3)*(f^p*f)^(-3*u^2)
True
#algorithm 9: New addition chain def algorithm_9(f,u): t0=f^(-u) y3=t0^2 y0=t0*y3 y2=y3^p y2=y3*y2 y2=y2^2 y2=y2*y3 t0=y0^(-u) y0=f^(-1) y1=t0^(p^2) y1=y0*y1 t0=t0^(-1) y3=t0^p y3=t0*y3 t0=t0^2 y1=t0*y1 t0=y3^(-u) t0=t0^2 t0=t0^(-1) y3=t0*y3 t0=f^p y0=f^(p^2) y0=t0*y0 t0=f^(p^3) y0=t0*y0 t0=y3^2 t0=t0*y2 y3=t0*y0 t0=t0*y1 t0=t0^2 t0=t0*y3 return t0
algorithm_9(f,u)==f^((p^4-p^2+1)/r)
True
#algorithm10: New Variant of Fuentes et al def algorithm_10(f,u): t0=f^(-u) t0=t0^2 t2=t0^(-u) t1=t2^2 t2=t2*t1 t2=t2*f t1=t2^(-2*u-1) t3=t1^(-1) t1=t0^2 t1=t1*f t1=t1^(-1) t1=t1*t3 t0=t0*t1 t2=t2*t1 t3=t1^(p^2) t2=t2*t3 t3=f^(-1) t3=t0*t3 t1=t3^(p^3) t2=t2*t1 t1=t0^p t1=t2*t1 return t1
True
#algorithm11: New multiple of d def algorithm_11(f,u): t0=f^(-u) t0=t0^2 t1=t0^2 t0=t0*t1 t1=f*t0 t2=f^2 t2=t2^2 t2=t2*t1 t2=t2^(-1) t2=t2^(p^3) t1=t1^2 t1=t1*f t1=t1^(-1) t1=t1^(p^2) t1=t1*t2 t2=t0^(-u) t2=f*t2 t1=t1*t2 t0=t2^(-1) t2=t0^(p^3) t1=t1*t2 t2=t0^(-6*u-4) t0=t2^(p^2) t1=t1*t0 t2=t0^p t1=t1*t2 t0=f^p t1=t1*t0 return t1
algorithm_11(f,u)==(f^((p^4-p^2+1)/r))^(36*u^3+18*u^2+6*u+1)
True
For the arithmetic in the finite fields Fp2, Fp6 and Fp12 please consult this link: https://cloud.sagemath.com/#projects/332de229-174f-4d90-ae79-ca9d3b0fc1f7/files/arithmetic.sagews