Path: blob/master/Discrete-Logarithm-Problem/Elliptic-Curve-DLP/Algo-Baby-Step-Giant-Step/README.md
1402 views
Baby Step Giant Step Algorithm
Prerequisites:
A method to reduce the time complexity of solving DLP is to use Baby Step Giant Step Algorithm. While brute forcing DLP takes polynomial time of the order , Baby Step Giant Step Algorithm can compute the value of
x
in polynomial time complexity. Here,
n
is the order of the subgroup generated by the base point P
of an Elliptic Curve E
.
This algorithm is a tradeoff between time and space complexity, as we will see when we discuss the algorithm.
Algorithm
x
can be expressed as x = i*m + j, where and
0 <= i,j < m
.
Hence, we have:
We can now use the above property for solving DLP as follows:
Iterate
j
in its range and store all values ofwith corresponding values of
j
in a lookup table.Run through each possible iteration of
i
and check ifexists in the table (ie. check if
==
).
If it does then return i*m + j as the value of
x
Else, continue
Shortcomings
Although the algorithm is more efficient as compared to plain brute-forcing, other algorithms of the same time complexity (Pollard's rho) are used for solving ECDLPs because of the fact that storing the look up table requires quite a lot of space.
Implementation
I wrote an implementation of the above algorithm in python/sage:
You can check out the complete code here: bsgs_ecdlp.py