都是统代数系,但比MAPLE和MATHMATICA强在专,对学ECC来说,elliptic curve in 在无限域的Q/R/C/p进数,有限域的ZP都有函数实现,PARI/GP有些代码是汇编语言写的,其它大都能看C代码,GUN嘛
PARI/GP 作者Henri Cohen,就不多讲了,和FREY共著Handbook of Elliptic and Hyperelliptic Curve Cryptography,我国ECC书抄这书的一点点,就能买钱,FREY曲线和怀尔斯,都听过地
MAGMA 岩浆?还有个同名的,不要混了,在线http://magma.maths.usyd.edu.au/calc/ 没绘图功能PLOT之类的,可以肯定比单独下个收费的功能少,不过对ECC初学者从C库MSDN那是方便多了,搜了N天,有人放这了,快下载收好了,http://sourceforge.net/projects/maxima/files/Maxima-Windows/5.23.2-Windows/maxima-5.23.2.exe/download
SPRINGER出了岩浆书Discovering Mathematics with Magma,GOOGLE.COM下就能下
PARI/GP下好安装后,有个GP.EXE,双击
(13:23) gp > ?
Help topics: for a list of relevant subtopics, type ?n for n in
0: user-defined identifiers (variable, alias, function)
1: Standard monadic or dyadic OPERATORS
2: CONVERSIONS and similar elementary functions
3: TRANSCENDENTAL functions
4: NUMBER THEORETICAL functions
5: Functions related to ELLIPTIC CURVES 6: Functions related to general NUMBER FIELDS
7: POLYNOMIALS and power series
8: Vectors, matrices, LINEAR ALGEBRA and sets
9: SUMS, products, integrals and similar functions
10: GRAPHIC functions
11: PROGRAMMING under GP
12: The PARI community
第四项是数论的
(14:12) gp > ?4
addprimes bestappr bezout bezoutres bigomega
binomial chinese content contfrac contfracpnqn
core coredisc dirdiv direuler dirmul
divisors eulerphi factor factorback factorcantor
factorff factorial factorint factormod ffinit
fibonacci gcd hilbert isfundamental ispower
isprime ispseudoprime issquare issquarefree kronecker
lcm moebius nextprime numbpart numdiv
omega precprime prime primepi primes
qfbclassno qfbcompraw qfbhclassno qfbnucomp qfbnupow
qfbpowraw qfbprimeform qfbred qfbsolve quadclassunit
quaddisc quadgen quadhilbert quadpoly quadray
quadregulator quadunit removeprimes sigma sqrtint
zncoppersmith znlog znorder znprimroot znstar
EC初始化用ellinit:(14:41) gp > ? ellinit
ellinit(x,{flag=0}): x being the vector [a1,a2,a3,a4,a6] defining the curve
Y^2 + a1.XY + a3.Y = X^3 + a2.X^2 + a4.X + a6, gives the vector:
[a1,a2,a3,a4,a6,b2,b4,b6,b8,c4,c6,disc,j,[e1,e2,e3],,eta1,etw1,w2a2,area]. If
the curve is defined over a p-adic field, the last six components are replaced
by root,u^2,u,q,w,0. If optional flag is 1, omit them altogether. x can also
be a string, in this case the coefficients of the curve with matching name are
looked in the elldata database if available.
21个参数,前五个
a1,a2,a3,a4,a6,这六项就是正规表式的EC曲线Y^2 + a1.XY + a3.Y = X^3 + a2.X^2 + a4.X + a6系数,
b2,b4,b6,b8,c4,c6,disc,j这七项和EC曲线变换有关,和曲线划分有关,奇异非奇异等等,在R域上图像就是有没尖点---光滑
[e1,e2,e3],,eta1,etw1,w2a2,area这七项应该和C域有关,C域上EC曲线是个轮胎,正在学这个轮胎
flag=1,X还可以是字符串
找条曲线试试,E.tate,E.w这两看来是在P进数域才能用的
Y^2 + a1.XY + a3.Y = X^3 + a2.X^2 + a4.X + a6都可变成Y^2=x^3+ax+b形式
Y^2=X^3+7X+8
(15:20) gp > E=ellinit([0,0,0,7,8]);
(15:20) gp > E.a1
%9 = 0
(15:20) gp > E.a2
%10 = 0
(15:20) gp > E.a3
%11 = 0
(15:20) gp > E.a4
%12 = 7
(15:20) gp > E.a6
%13 = 8
(15:20) gp > E.b2
%14 = 0
(15:21) gp > E.b4
%15 = 14
(15:21) gp > E.b6
%16 = 32
(15:21) gp > E.b6
%17 = 32
(15:21) gp > E.c4
%18 = -336
(15:21) gp > E.c6
%19 = -6912
(15:21) gp > E.disc
%20 = -49600
(15:26) gp > E.roots
%21 = [-1.000000000000000000000000000, 0.5000000000000000000000000000 - 2.783
181415010961059735649*I, 0.5000000000000000000000000000 + 2.78388218141501096
9735649*I]~
(15:31) gp > E.omega[1]
%22 = 2.400226835016717000625368437
(15:32) gp > E.area
%23 = 2.284807014575569154497352277
(15:33) gp > E.tate
*** curve not defined over a p-adic field.
(15:33) gp > E.w
*** curve not defined over a p-adic field.
(15:34) gp > E.eta1
这两个是以前版本的命令:
(15:37) gp > initell([0,0,0,7,8]);
*** obsolete function: initell([0,0,0,7,8])
^--------------------
For full compatibility with GP 1.39.15, type "default(compatible,3)", or set
"compatible = 3" in your GPRC file.
New syntax: initell(x) ===> ellinit(x)
(15:37) gp > smallinitell([0,0,0,7,8]);
*** obsolete function: smallinitell([0,0,0,
^--------------------
For full compatibility with GP 1.39.15, type "default(compatible,3)", or set
"compatible = 3" in your GPRC file.
New syntax: smallinitell(x) ===> ellinit(x,1)
求个切线自加点,
z1=[4,10];
z2=[4,10]; elladd(E,z1,z2)
12 = [-7/16, 141/64]
(16:42) gp > ?ellisoncurve
ellisoncurve(e,x): true(1) if x is on elliptic curve e, false(0) if not.
16:42) gp > ellisoncurve(E,[-7/16, 141/64])
13 = 1
RATIONAL CURVES AND CONICS
ELLIPTIC CURVES
ELLIPTIC CURVES OVER FINITE FIELDS
ELLIPTIC CURVES OVER FUNCTION FIELDS
MODELS OF GENUS ONE CURVES
HYPERELLIPTIC CURVES
L-FUNCTIONS
RATIONAL CURVES AND CONICS --------有理圆锥曲线,2次的椭双抛,之间的同
态同构自同构,中学生就懂
ELLIPTIC CURVES OVER FINITE FIELDS ,HYPERELLIPTIC CURVES 有限域椭圆曲线,ECC就建在他上
FUNCTION FIELDS 函数域椭圆曲线,可能泛函学过之后才行
ODELS OF GENUS ONE CURVES 亏格一曲线的模式
L-FUNCTIONS L 函数,很多方面都爱往 L 函数上凑。。。。。。
初始化用EllipticCurve,超椭圆,非超奇异,超奇异都用他
EllipticCurve(C) : Sch -> CrvEll, MapSch
SetVerbose("EllModel", n): Maximum: 3Given a scheme C describing a curve of genus 1 with an easily recognised rational point, the function returns an elliptic curve E, together with a birational map from C to E. If there is no "obvious" rational point then this routine will fail. C must belong to one of the following classes:
(i)Hyperelliptic curves of genus 1 of the form C: y2 + h(x)y=f(x) with f of degree 3 or 4 and h of degree at most 1. If the function x on C has a rational branch point then that point is sent to the origin on E. Otherwise, if C has a rational point at x=∞ then that point is used.
(ii)Nonsingular plane curves of degree 3. If the curve is already in general Weierstrass form up to a permutation of the variables, then this is recognised and used as a model for the elliptic curve. Otherwise the base field of the curve must have characteristic different from 2 and 3; in this case, the curve is tested for having a rational flex. If it has, then a linear transformation suffices to get the curve into general Weierstrass form, and this is used.
(iii)Singular plane curves of degree 4 over a base field of characteristic different from 2 with a unique cusp, with the tangent cone meeting the curve only at that point. Up to linear transformation, these are curves of type y2=f(x), with f of degree 4. Such curves are brought into the standard form above. If either a rational point exists with x=0 or the curve intersects the line at infinity in a rational point, then that point is used to put the curve in general Weierstrass formEllipticCurve([a1, a2, a3, a4, a6]) :
Elliptic Curve defined by y^2 = x^3 + 7.00000000000000000000000000000*x +
8.00000000000000000000000000000 over Complex field of precision 30
不变量。。。。??
参数对应,还能省略,自动认超奇异
E:=EllipticCurve([0,0,0,7, 8]);
E;
E1:=EllipticCurve([7, 8]);
E1;
E2 := EllipticCurve([GF(17) | 7, 8]);
E2;
E3 := EllipticCurve([GF(19) | 7, 8]);
E3;
E4 := EllipticCurve([GF(31) | 7, 8]);
E4;
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Rational Field
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Rational Field
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over GF(17)
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over GF(19)
>> E4 := EllipticCurve([GF(31) | 7, 8]);
^
Runtime error in 'EllipticCurve': Curve is singular
>> E4;
^
User error: Identifier 'E4' has not been declared or assigned
Elliptic Curve defined by y^2 + 1/12*x*y + y = x^3 + 1/22*x^2 + 1/13*x + 41 over
Rational Field
Elliptic Curve defined by y^2 + 143*x*y + 5053029696*y = x^3 + 133848*x^2 +
666999919872*x + 1046857473454971949056 over Rational Field
最小
> ME := MinimalModel(IE);
> ME;
Elliptic Curve defined by y^2 + x*y = x^3 + 1021854892776*x +
1053193319031442674240 over Rational Field
常规式,就最常见的了 WeierstrassModel(E2);
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over GF(17)
[ IsIsomorphic(E3,E) : E in S1 ];
[ IsIsomorphic(E2,E) : E in S2 ];
Elliptic Curve defined by y^2 = x^3 + 16*x + 1 over GF(19)
Elliptic Curve defined by y^2 = x^3 + 5*x + 14 over GF(17)
[
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over GF(19),
Elliptic Curve defined by y^2 = x^3 + 7*x + 11 over GF(19)
]
[
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over GF(17),
Elliptic Curve defined by y^2 = x^3 + 12*x + 5 over GF(17)
]
[ true, false ]
[ true, false ]
Elliptic Curve defined by y^2 = x^3 - 4*x^2 + 16 over Rational Field
[ (0 : 1 : 0), (0 : 4 : 1), (4 : -4 : 1), (4 : 4 : 1), (0 : -4 : 1) ]
Elliptic Curve defined by y^2 = x^3 - 4*x^2 + 16 over Rational Field
[ (0 : 1 : 0), (0 : 4 : 1), (4 : -4 : 1), (4 : 4 : 1), (0 : -4 : 1) ]
Abelian Group isomorphic to Z/5
Defined on 1 generator
Relations:
5*MW.1 = 0
Elliptic Curve defined by y^2 = x^3 + 7*x + 8 over Rational Field
[ (0 : 1 : 0), (-1 : 0 : 1) ]
Abelian Group isomorphic to Z/2 + Z + Z
Defined on 3 generators
Relations:
2*MW.1 = 0
n;----------------------------------------------------E中n阶子循环群这
P := Random(E) * (Order(E) div n); -----找了个基点
P;
Order(P) eq n; -------------------------------------基点的阶
d := Random(n);
Q := d*P; 随机选的d<p,可能是密匙服务器生成
Q;
M := Random(n); 甲方 要发的明文
> M;
k := Random(n); 甲方随机选k<p
kp_seq := ElementToSequence (k*P); 计算点乘k*P,表示成点
kp_seq;
r := (IntegerRing()!kp_seq[1]) mod n; 不管k*P多大 都要mod n
s := (Modinv (k, n) * (M + d*r)) mod n; 经过求模逆,模乘,模加,签好了
> s;
r in [1..n-1];
s in [1..n-1];
w := Modinv (s, n); 下面是乙方验证,也要经过求点乘,模逆,模乘,模加
u1 := M*w mod n;
u2 := r*w mod n;
temp := u1*P + u2*Q;
temp;
temp_seq := ElementToSequence (temp);
> v := (IntegerRing()!temp_seq[1]) mod n;
> v;
v eq r; 验证EQUAL,OK
有理域下定义超椭圆曲线:
P<x> := PolynomialRing(RationalField());
> C := HyperellipticCurve(x^6+x^2+1);
C;
复域下定义超椭圆曲线:
P<x> := PolynomialRing(ComplexField());
> C := HyperellipticCurve(x^6+x^2+10);
C;
Hyperelliptic Curve defined by y^2 = x^6 + x^2 + 10.0000000000000000000000000000
over Complex field of precision 30
from sage.databases.cremona import LargeCremonaDatabase
随机选一条:
CremonaDatabase().random()
Elliptic Curve defined by y^2 + x*y = x^3 - x^2 + 324*x - 18068 over
Rational FieldElliptic Curve defined by y^2 + x*y = x^3 - x^2 + 324*x - 18068 over Rational Field
[Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7*x - 9 over Rational
Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 49*x - 58
over Rational Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2
- 454*x + 3506 over Rational Field, Elliptic Curve defined by y^2 + x*y
+ y = x^3 + x^2 - 7249*x + 234536 over Rational Field, Elliptic Curve
defined by y^2 + x*y + y = x^3 + x^2 - 139*x + 8672 over Rational Field,
Elliptic Curve defined by y^2 + y = x^3 + x^2 - 14*x + 3677 over
Rational Field][Elliptic Curve defined by y^2 + y = x^3 - x^2 - 7*x - 9 over Rational Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 49*x - 58 over Rational Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 454*x + 3506 over Rational Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 7249*x + 234536 over Rational Field, Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 - 139*x + 8672 over Rational Field, Elliptic Curve defined by y^2 + y = x^3 + x^2 - 14*x + 3677 over Rational Field]
列出给定前导子的所有曲线数:
c = CremonaDatabase()
c.number_of_curves(9920)
70
FSD猜想。千年问题: