2.5.1: Discrete logarithm - Shank's algorithm (baby-step giant-step)

Shank's algorithm, also known as "baby-step giant-step" algorithm calculates the value x
for the discrete logarithm &alphax ≡ &beta Mod p.


Steps of the algorithm:
1.m = ⌈&radic(p-1)⌉
2.For all j with 0 ≤ j < m:
Calculate &alphamj Mod p
Sort the pairs (j, &alphamj Mod p) according to the second component
4.Calculate &beta&alphai-1 Mod p for i with 0 ≤ i < m
Until one value &beta&alphai-1 Mod p match with &alphamj Mod p from step 2
5.Build x = log&alpha &beta = mj + i Mod p-1 with the calculated values



source






3 Classic methods