[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
setmod_ff
:: Sets/Gets the current base fields.
number or polynomial
prime
univariate polynomial irreducible over GF(2)
univariate polynomial irreducible over GF(p)
the extension degree
setmod_ff(defpoly,p)
,
[defpolyp,p] is returned.
If it is GF(p^n) defined by setmod_ff(p,n)
,
[p,defpoly,prim_elem] is returned. Here, defpoly
is the defining polynomial of the n-th extension,
and prim_elem is the generator of the multiplicative group
of GF(p^n).
defpoly_mod2()
is recommended
for efficiency.
[174] defpoly_mod2(100); x^100+x^15+1 [175] setmod_ff(@@); x^100+x^15+1 [176] setmod_ff(); x^100+x^15+1 [177] setmod_ff(x^4+x+1,547); [1*x^4+1*x+1,547] [178] setmod_ff(2,5); [2,x^5+x^2+1,x]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
field_type_ff
:: Type of the current base field.
integer
[0] field_type_ff(); 0 [1] setmod_ff(3); 3 [2] field_type_ff(); 1 [3] setmod_ff(x^2+x+1); x^2+x+1 [4] field_type_ff(); 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
field_order_ff
:: Order of the current base field.
integer
[0] field_order_ff(); field_order_ff : current_ff is not set return to toplevel [0] setmod_ff(3); 3 [1] field_order_ff(); 3 [2] setmod_ff(x^2+x+1); x^2+x+1 [3] field_order_ff(); 4
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
characteristic_ff
:: Characteristic of the current base field.
integer
[0] characteristic_ff(); characteristic_ff : current_ff is not set return to toplevel [0] setmod_ff(3); 3 [1] characteristic_ff(); 3 [2] setmod_ff(x^2+x+1); x^2+x+1 [3] characteristic_ff(); 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
extdeg_ff
:: Extension degree of the current base field over the prime field.
integer
[0] extdeg_ff(); extdeg_ff : current_ff is not set return to toplevel [0] setmod_ff(3); 3 [1] extdeg_ff(); 1 [2] setmod_ff(x^2+x+1); x^2+x+1 [3] extdeg_ff(); 2
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
simp_ff
:: Converts numbers or coefficients of polynomials into elements in finite fields.
number or polynomial
number or polynomial
simp_ff
ensures that the output has
the reduced representation.
If a small finite field is set as a ground field,
an integer is projected the finite prime field, then
it is embedded into the ground field. ptosfp()
can be used for direct projection to the ground field.
[0] simp_ff((x+1)^10); x^10+10*x^9+45*x^8+120*x^7+210*x^6+252*x^5+210*x^4+120*x^3+45*x^2+10*x+1 [1] setmod_ff(3); 3 [2] simp_ff((x+1)^10); 1*x^10+1*x^9+1*x+1 [3] ntype(coef(@@,10)); 6 [4] setmod_ff(2,3); [2,x^3+x+1,x] [5] simp_ff(1); @_0 [6] simp_ff(2); 0 [7] ptosfp(2); @_1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
random_ff
:: Random generation of an element of a finite field.
element of a finite field
random()
, lrandom()
is used.
[0] random_ff(); random_ff : current_ff is not set return to toplevel [0] setmod_ff(pari(nextprime,2^40)); 1099511627791 [1] random_ff(); 561856154357 [2] random_ff(); 45141628299
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
lmptop
:: Converts the coefficients of a polynomial over GF(p) into integers.
integral polynomial
polynomial over GF(p)
[0] setmod_ff(pari(nextprime,2^40)); 1099511627791 [1] F=simp_ff((x-1)^10); 1*x^10+1099511627781*x^9+45*x^8+1099511627671*x^7+210*x^6 +1099511627539*x^5+210*x^4+1099511627671*x^3+45*x^2+1099511627781*x+1 [2] setmod_ff(547); 547 [3] F=simp_ff((x-1)^10); 1*x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3 +45*x^2+537*x+1 [4] lmptop(F); x^10+537*x^9+45*x^8+427*x^7+210*x^6+295*x^5+210*x^4+427*x^3 +45*x^2+537*x+1 [5] lmptop(coef(F,1)); 537 [6] ntype(@@); 0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ntogf2n
:: Converts a non-negative integer into an element of GF(2^n).
element of GF(2^n)
non-negative integer
simp_ff()
to reduce the result.
[1] setmod_ff(x^30+x+1); x^30+x+1 [2] N=ntogf2n(2^100); (@^100) [3] simp_ff(N); (@^13+@^12+@^11+@^10)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gf2nton
:: Converts an element of GF(2^n) into a non-negative integer.
non-negative integer
element of GF(2^n)
gf2nton
.
[1] setmod_ff(x^30+x+1); x^30+x+1 [2] N=gf2nton(2^100); (@^100) [3] simp_ff(N); (@^13+@^12+@^11+@^10) [4] gf2nton(N); 1267650600228229401496703205376 [5] gf2nton(simp_ff(N)); 15360
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ptogf2n
:: Converts a univariate polynomial into an element of GF(2^n).
element of GF(2^n)
univariate polynomial
@
for
the variable of poly.
[1] setmod_ff(x^30+x+1); x^30+x+1 [2] ptogf2n(x^100); (@^100)
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gf2ntop
:: Converts an element of GF(2^n) into a polynomial.
univariate polynomial
an element of GF(2^n)
indeterminate
ptogf2n()
call. The default variable is x
.
[1] setmod_ff(x^30+x+1); x^30+x+1 [2] N=simp_ff(gf2ntop(2^100)); (@^13+@^12+@^11+@^10) [5] gf2ntop(N); [207] gf2ntop(N); x^13+x^12+x^11+x^10 [208] gf2ntop(N,t); t^13+t^12+t^11+t^10
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ptosfp
, sfptop
:: Transformation to/from a small finite field
polynomial
polynomial
ptosfp()
converts coefficients of a polynomial to
elements in a small finite field GF(p^n) set as a ground field.
If a coefficient is already an element of the field,
no conversion is done. If a coefficient is a positive integer,
then its residue modulo p^n is expanded as p-adic integer,
then p is substituted by x, finally the polynomial
is converted to its corresponding logarithmic representation
with respect to the primitive element.
For example, GF(3^5) is represented as F(3)[x]/(x^5+2*x+1),
and each element of the field is represented as @_k
by its exponent k with respect to the primitive element x.
23 = 2*3^2+3+2 is represented as 2*x^2+x+2 and
it is equivalent to x^17 modulo x^5+2*x+1.
Therefore an integer 23 is conterted to @_17.
sfptop()
is the inverse of ptosfp()
.
[196] setmod_ff(3,5); [3,x^5+2*x+1,x] [197] A = ptosfp(23); @_17 [198] 9*2+3+2; 23 [199] x^17-(2*x^2+x+2); x^17-2*x^2-x-2 [200] sremm(@,x^5+2*x+1,3); 0 [201] sfptop(A); 23
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
defpoly_mod2
:: Generates an irreducible univariate polynomial over GF(2).
univariate polynomial
positive integer
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
sffctr
:: Irreducible factorization over a small finite field.
list
polynomial over a finite field
[0] setmod_ff(2,10); [2,x^10+x^3+1,x] [1] sffctr((z*y^3+z*y)*x^3+(y^5+y^3+z*y^2+z)*x^2+z^11*y*x+z^10*y^3+z^11); [[@_0,1],[@_0*z*y*x+@_0*y^3+@_0*z,1],[(@_0*y+@_0)*x+@_0*z^5,2]]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
fctr_ff
:: Irreducible univariate factorization over a finite field.
list
univariate polynomial over a finite field
[178] setmod_ff(2^64-95); 18446744073709551521 [179] fctr_ff(x^5+x+1); [[1*x+14123390394564558010,1],[1*x+6782485570826905238,1], [1*x+15987612182027639793,1],[1*x^2+1*x+1,1]]
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
irredcheck_ff
:: Primality check of a univariate polynomial over a finite field.
0|1
univariate polynomial over a finite field
[178] setmod_ff(2^64-95); 18446744073709551521 [179] ] F=x^10+random_ff(); x^10+14687973587364016969 [180] irredcheck_ff(F); 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
randpoly_ff
:: Generation of a random univariate polynomial over a finite field.
polynomial
positive integer
indeterminate
random_ff()
.
[178] setmod_ff(2^64-95); 18446744073709551521 [179] ] F=x^10+random_ff(); [180] randpoly_ff(3,x); 17135261454578964298*x^2+4766826699653615429*x+18317369440429479651 [181] randpoly_ff(3,x); 7565988813172050604*x^2+7430075767279665339*x+4699662986224873544 [182] randpoly_ff(3,x); 10247781277095450395*x^2+10243690944992524936*x+4063829049268845492
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ecm_add_ff
, ecm_sub_ff
, ecm_chsgn_ff
:: Addition, Subtraction and additive inverse for points on an elliptic curve.
vector or 0
vector of length 3 or 0
vector of length 2
[0] setmod_ff(1125899906842679)$ [1] EC=newvect(2,[ptolmp(1),ptolmp(1)])$ [2] Pt1=newvect(3,[1,-412127497938252,1])$ [3] Pt2=newvect(3,[6,-252647084363045,1])$ [4] Pt3=ecm_add_ff(Pt1,Pt2,EC); [ 560137044461222 184453736165476 125 ] [5] F=y^2-(x^3+EC[0]*x+EC[1])$ [6] subst(F,x,Pt3[0]/Pt3[2],y,Pt3[1]/Pt3[2]); 0 [7] ecm_add_ff(Pt3,ecm_chsgn_ff(Pt3),EC); 0 [8] D=ecm_sub_ff(Pt3,Pt2,EC); [ 886545905133065 119584559149586 886545905133065 ] [9] D[0]/D[2]==Pt1[0]/Pt1[2]; 1 [10] D[1]/D[2]==Pt1[1]/Pt1[2]; 1
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] |
This document was generated on December 22, 2024 using texi2html 5.0.