Solve discrete logs with brute force or giant-step. Review powers, orders, collisions, and method details. Download outputs and visualize modular patterns with simple charts.
This page is best for modest educational inputs and bounded searches. Very large cryptographic cases are outside the practical scope of a browser page.
| Base g | Target h | Modulus n | Smallest x | Check |
|---|---|---|---|---|
| 5 | 8 | 23 | 6 | 5^6 ≡ 8 (mod 23) |
| 2 | 18 | 29 | 11 | 2^11 ≡ 18 (mod 29) |
| 3 | 13 | 17 | 4 | 3^4 ≡ 13 (mod 17) |
The calculator solves the modular equation g^x ≡ h (mod n). Here, g is the base, h is the target residue, n is the modulus, and x is the unknown exponent.
Brute force tests exponents one by one until a match appears or the chosen bound ends. This gives transparent residue tracking and is useful for teaching and verification.
Baby-step giant-step rewrites x as x = im + j, where m is about the square root of the search bound. It stores baby steps g^j and compares them with transformed giant steps h(g^-m)^i.
When gcd(g, n) = 1, the base belongs to the multiplicative unit group modulo n. In that case, the multiplicative order of g helps explain repeated solutions because exponents differ by multiples of that order.
A discrete logarithm asks for an exponent x such that g^x matches a target residue h modulo n. It is the modular counterpart of ordinary logarithms.
A solution may not exist for the chosen values, or it may exist beyond the selected exponent bound. Some inputs also fall outside the relevant unit structure.
Use brute force when you want a transparent educational search, a short exponent range, or a direct residue table showing each tested step.
Use it for wider bounded searches when the base is invertible modulo n. It reduces search effort by splitting the exponent into smaller matching parts.
The multiplicative order is the smallest positive integer r with g^r ≡ 1 (mod n). It explains periodic repeats in valid exponents.
Normalization replaces negative or large entries with their least nonnegative residues modulo n. That keeps every computation in a consistent modular form.
This page is designed for bounded educational work. Very large cryptographic sizes demand specialized libraries, optimized arithmetic, and much more memory.
They show the residue walk g^x mod n across the selected range. This helps you spot cycles, repeated patterns, and target matches visually.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.