Open in CoCalc
R.<u>=QQ['u']
p=(u-1)^2*(u^4-u^2+1)/3+u
r=u^4-u^2+1
d=(p^4-p^2+1)/r
C.<c>=ZZ['c']

l0=u^5-2*u^4+2*u^2-u+3
l1=u^4-2*u^3+2*u-1
l2=u^3-2*u^2+u
l3=u^2-2*u+1

#Our new development of the vectors li (0<=i<=3)----------------
s3=u^2-(u-1)-u
s0=l1*u+3
s1=l2*u-l3
s2=s3*u


l0==s0; l1==s1;
l2==s2; l3==s3

True True True True
l0^2


u^10 - 4*u^9 + 4*u^8 + 4*u^7 - 10*u^6 + 10*u^5 - 8*u^4 - 4*u^3 + 13*u^2 - 6*u + 9













u=(-2^107+2^105+2^93+2^5)
p=(u-1)^2*(u^4-u^2+1)/3+u
r=u^4-u^2+1
t=u+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
#---------------------------------------

147bb7b-824f-4aba-b95b-10ab277f807es︠

Fp12.is_field(); Fp6.is_field(); Fp2.is_field();

f1=Fp12.random_element()

Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'Fp12' is not defined
f=(f1^(p^6-1))^(p^2+1)

#algorithm 1: New variant of Aranha et al. for computing the hard part of the final exponentiation of optimal Ate pairing on BLS12 curves
def algorithm_1 (f,u):

t0=f^2
t1=t0^(u)
t2=t1^(u/2)
t3=f^(-1)
t1=t3*t1
t1=t1^(-1)
t1=t1*t2

t2=t1^(u)

t3=t2^(u)
t1=t1^(-1)

t3=t1*t3

t1=t1^(-1)
t1=t1^(p^3)
t2=t2^(p^2)

t1=t1*t2
t2=t3^(u)
t2=t2*t0
t2=t2*f
t1=t1*t2

t2=t3^p
t1=t1*t2

return t1

Error in lines 1-2 Traceback (most recent call last): File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'f1' is not defined
algorithm_1 (f,u)==f^(3*(p^4-p^2+1)/r)

Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.10/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'algorithm_1' is not defined