Baby Step, Giant Step
The simple iterative approach
Baby Step, Giant Step is a very simple approach to solving the DLP often described as a meet-in-the-middle algorithm.
Approach
Let us say that ax≡bmodp. First we choose an arbitrary number k, which defines how many iterations we try. Next we evaluate
Following that, we evaluate
If the DLP has a soultion, there will be at least one common value in both lists. If we let these common values be an and ba−mk, we can then solve it easily from there:
Solving the DLP! A few problems arise, however.
You will first notice that our choice of k is arbitrary. If p is large enough, this approach becomes completely infeasible, so using solely this algorithm is only effective when p is small. After all, this is a very naive brute-force approach.
Implementing BSGS
In Sage, this is quite simple:
And we can test it easily too
Last updated
Was this helpful?