← LibraryBrute-Force Discrete Logarithm SearchEngineering · MathematicsLesson 126/203← PrevNext →
ArticlePublished 7 Aug 20263 min readBy Kevin Jogin

Engineering  /  Mathematics  — Discrete Logarithms and Factoring

Brute-Force Discrete Logarithm Search

Exhaustive search for discrete logarithms, its cost, and its role as the baseline against which other methods are measured.

Page KV-MATH-0397Reading time 3 minReviewed 2026-08-07Author Kevin Jogin

Executive summary

The discrete logarithm can always be found by trying every exponent. The cost is linear in the group order, which is exponential in the bit length.

It establishes the baseline that every better algorithm is measured against, and it is the correct method for very small groups.

Learning objectives

  1. State the discrete logarithm problem.
  2. Give the brute-force method and its cost.
  3. Explain why linear in the group order is exponential.

01The problem

Definition

Discrete logarithm

Given a cyclic group G generated by γ and an element α ∈ G, find the integer x with γ^x = α.

The value x is determined modulo the order of γ.

The problem is the inverse of exponentiation, which is easy by repeated squaring. The asymmetry between the two directions is what makes the problem useful cryptographically.

02Exhaustive search

Algorithm

Brute-force discrete logarithm

Inputgenerator γ, target α, group order q
Outputx with γ^x = α
  1. Set β = 1 (the identity).
  2. For x from 0 to q − 1 where q is the group order:
  3.   If β = α, return x.
  4.   Set β = β · γ.
  5. Report that α is not in the subgroup generated by γ.
Cost  O(q) group operations, O(1) memory

Multiplying by γ at each step rather than recomputing a power keeps each iteration to one group operation. Memory is constant, which is the method's only advantage.

03Why linear is exponential

  1. Brute forceO(q)Exponential in the bit length of q
  2. Baby step giant stepO(√q) time and memorySquare root; the generic bound
  3. Pollard's rhoO(√q) time, O(1) memorySame time, constant memory
  4. Pohlig-HellmanO(√q_max)Reduces to the largest prime factor of q
  5. Index calculusSubexponentialOnly for groups with a factor base, such as Z_p*

For a group of order about 2^256, brute force requires 2^256 operations, which is beyond any conceivable resource. The square-root methods reduce this to 2^128, which is the security level such a group is chosen to provide.

04Frequently asked questions

Why is the discrete logarithm easy in additive groups?

Because exponentiation there is multiplication by an integer, and inverting it is division — a single extended Euclid computation. The hardness of the multiplicative case comes from the group's structure, not from the problem's shape.

Does brute force ever get used?

For very small subgroups, and inside Pohlig-Hellman where the problem has been reduced to groups of small prime order. In those settings it is simpler than the alternatives and fast enough.

What makes elliptic curve groups preferable?

No index calculus method is known for them, so the best attacks are the generic square-root ones. That allows much smaller groups for the same security level — 256 bits rather than 3072.

Sources and method

Structural reference: Victor Shoup, A Computational Introduction to Number Theory and Algebra, Version 1, Cambridge University Press, 2005 — book pages 270-271.

This page carries the durable method layer only: definitions, constructions, algorithms, complexity results and selection criteria, authored originally for KEVOS. No text is transcribed or paraphrased from the source, and no numeric tables or benchmark data are reproduced — these are routed to live authoritative sources instead.

Author: Kevin Jogin. Last reviewed 2026-08-07.

Continue learning

Finding a Generator of the Group of Units Modulo pArticle · MathematicsNEXT LESSON →The Baby Step/Giant Step MethodArticle · MathematicsThe AKS Algorithm and Its AnalysisArticle · MathematicsDiscrete Logarithms in Groups of Prime Power OrderArticle · Mathematics