commands → logmod
logmod(A,B,P)
The logmod command solves A = B^X mod P for non-negative integers, that is,
it computes the logarithm of A to the base B modulo P.
If the logarithm does not exist then null is returned.
Examples
# solve 5 = 4^X mod 11
logmod(5,4,11);
2
(4^2) % 11;
5
Algorithm
The Pohlig-Hellman algorithm and Pollard's rho algorithm are used to compute discrete logarithms.
References
Link to Handbook of Applied Cryptography
Cohen, Henri. A Course in Computational Algebraic Number Theory. Springer, 1993.
Koblitz, Neal. A Course in Number Theory and Cryptography. Springer, 1998.