Let K be a field of cardinality q=pk, with p prime. Magma contains several advanced algorithms for computing discrete logarithms of elements of K. The two main kinds of algorithms used are as follows: (1) Pohlig-Hellman [PH78]: The running time is usually proportional to the square root of the largest prime l dividing q - 1; this is combined with the Shanks baby-step/giant-step algorithm (when l is very small) or the Pollard-ρ algorithm. (2) Index-Calculus: There is first a precomputation stage which computes and stores all the logarithms of a factor base (all the elements of the field corresponding to irreducible polynomials up to some bound) and then each subsequent individual logarithm is computed by expressing the given element in terms of the factor base.
The different kinds of finite fields in Magma are handled as follows (in this order):
The discrete logarithm of the non-zero element x from the field F, i.e., the unique integer k such that x = wk and 0 ≤k < (#F - 1), where w is the primitive element of F (as returned by PrimitiveElement). Default parameters are automatically chosen if an index-calculus method is used (use Sieve below to set parameters). See also the procedure SetPrimitiveElement.
The discrete logarithm to the base b of the non-zero element x from the field F, i.e., the unique integer k such that x = bk and 0 ≤k < (#F - 1). If b is not a primitive element, then in some unusual cases the algorithm may take much longer than normal.
The Zech logarithm Z(n) of the integer n for the field F, which equals the logarithm to base w of wn + 1, where w is the primitive element of F. If wn is the minus one element of K, then -1 is returned.
Lanczos: BoolElt Default: false
(Procedure.) Call the Gaussian integer sieve on the prime finite field K if possible; otherwise call the linear sieve on K (assuming K is not too small).If the parameter Lanczos is set to true, then the Lanczos algorithm [LO91b, Sec. 3] will be used for the linear algebra phase. This is generally very much slower than the default method (often 10 to 50 times slower), but it will take considerably less memory, so may be preferable for extremely large fields. See also the function ModularSolution in the chapter on sparse matrices for more information.
(Procedure.) Set the verbose printing level for the finite field logarithm algorithm to be v. Currently the legal values for v are 0, 1, and 2. If the level is 1, information is printed whenever the logarithm of an element is computed (unless the field is very small, in which case a lookup table is used). The value of 2 will print a very large amount of information.
> F<z> := FiniteField(7^4); > PrimitiveElement(F); z; > Log(z); 1 > Log(z^2); 2 > Log(z + 1); 419 > z^419 eq z + 1; true > b := z + 1; > b; z^419 > Log(b, b); 1 > Log(b, z); 779 > b^779 eq z; trueWe now do similar things for a larger field of characteristic 2, which will use Coppersmith's algorithm to compute the logarithms.
> F<z> := GF(2, 73); > Factorization(#F-1); [ <439, 1>, <2298041, 1>, <9361973132609, 1> ] > PrimitiveElement(F); z > time Log(z + 1); 4295700317032218908392 Time: 5.400 > z^4295700317032218908392; z + 1 > time Log(z + 1); 4295700317032218908392 Time: 0.000 > time Log(z^2); 2 Time: 0.000 > time Log(z^2134914112412412); 2134914112412412 Time: 0.000 > b := z + 1; > b; z + 1 > time Log(b, b); 1 Time: 0.010 > time Log(b, z); 2260630912967574270198 Time: 0.000 > b^2260630912967574270198; z