《Elliptic Curves Number Theory And Cryptography 2n》中Example 11.5, magma脚本:
clear;
q:=7;
Fq:=GF(q);
Fq2:=ExtensionField;
a:=0;
b:=2;
E:=EllipticCurve([Fq|a,b]);
fac:=Factorization(#E);
fac2:=Factorization(#E(Fq2));
points:=Points(E(Fq2));
TorsPts:={};
for i:=1 to #points do
if 3*points[i] eq Identity(E) then
Include(~TorsPts,points[i]);
end if;
end for;
function FlowerGenerator(TorsPts);
V:={};
S:=TorsPts;
petals:=Integers()!Sqrt(#S)+1;
ptsInPet:=petals-1;
T:={};
for i:=1 to petals do
S:=S diff V;
P:=Random(S);
while P[3] eq 0 do
P:=Random(S);
end while;
V:={j*P:j in [1..ptsInPet]};
Include(~T,V);
end for;
return T;
end function;
FlowerGenerator(TorsPts);
P:=E(Fq)![5,1];
Q:=E(Fq)![6,1];
R:=E(Fq)![0,3];
P+Q;
identitiy:=E(Fq)![0,1,0];
P+Q-P-Q;
identitiy;
对应执行结果为:
{
{ (0 : 1 : 0), (0 : 4 : 1), (0 : 3 : 1) },
{ (0 : 1 : 0), (5 : 6 : 1), (5 : 1 : 1) },
{ (6 : 1 : 1), (0 : 1 : 0), (6 : 6 : 1) },
{ (3 : 6 : 1), (0 : 1 : 0), (3 : 1 : 1) }
}
(3 : 6 : 1)
(0 : 1 : 0)
(0 : 1 : 0)
Example 11.7对应magma脚本为:
clear;
q:=11;
Fq:=GF(q);
Fq2:=ExtensionField;
a:=-1;
b:=1;
E:=EllipticCurve([Fq|a,b]);
fac:=Factorization(#E);
fac2:=Factorization(#E(Fq2));
points:=Points(E(Fq2));
#E;
Points(E(Fq));
TorsPts:={};
for i:=1 to #points do
if 5*points[i] eq Identity(E) then
Include(~TorsPts,points[i]);
end if;
end for;
TorsPts;
P:=E(Fq)![3,6];
Q:=E(Fq)![3,6];
R:=E(Fq)![0,1];
P+Q;
4*P;
5*P;
identitiy:=E(Fq)![0,1,0];
P+Q-P-Q;
identitiy;
3^5 mod 11;
对应执行结果为:
10
{@ (0 : 1 : 0), (0 : 1 : 1), (0 : 10 : 1), (1 : 1 : 1), (1 : 10 : 1), (3 : 5 :
1), (3 : 6 : 1), (5 : 0 : 1), (10 : 1 : 1), (10 : 10 : 1) @}
{ (10 : 10 : 1), (3 : 5 : 1), (0 : 1 : 0), (10 : 1 : 1), (3 : 6 : 1) }
(10 : 10 : 1)
(3 : 5 : 1)
(0 : 1 : 0)
(0 : 1 : 0)
(0 : 1 : 0)
1