- Source: Baby-step giant-step
In group theory, a branch of mathematics, the baby-step" target="_blank">step giant-step" target="_blank">step is a meet-in-the-middle algorithm for computing the discrete logarithm or order of an element in a finite abelian group by Daniel Shanks. The discrete log problem is of fundamental importance to the area of public key cryptography.
Many of the most commonly used cryptography systems are based on the assumption that the discrete log is extremely difficult to compute; the more difficult it is, the more security it provides a data transfer. One way to increase the difficulty of the discrete log problem is to base the cryptosystem on a larger group.
Theory
The algorithm is based on a space–time tradeoff. It is a fairly simple modification of trial multiplication, the naive method of finding discrete logarithms.
Given a cyclic group
G
{\displaystyle G}
of order
n
{\displaystyle n}
, a generator
α
{\displaystyle \alpha }
of the group and a group element
β
{\displaystyle \beta }
, the problem is to find an integer
x
{\displaystyle x}
such that
α
x
=
β
.
{\displaystyle \alpha ^{x}=\beta \,.}
The baby-step" target="_blank">step giant-step" target="_blank">step algorithm is based on rewriting
x
{\displaystyle x}
:
x
=
i
m
+
j
{\displaystyle x=im+j}
m
=
⌈
n
⌉
{\displaystyle m=\left\lceil {\sqrt {n}}\right\rceil }
0
≤
i
<
m
{\displaystyle 0\leq i
0
≤
j
<
m
{\displaystyle 0\leq j
Therefore, we have:
α
x
=
β
{\displaystyle \alpha ^{x}=\beta \,}
α
i
m
+
j
=
β
{\displaystyle \alpha ^{im+j}=\beta \,}
α
j
=
β
(
α
−
m
)
i
{\displaystyle \alpha ^{j}=\beta \left(\alpha ^{-m}\right)^{i}\,}
The algorithm precomputes
α
j
{\displaystyle \alpha ^{j}}
for several values of
j
{\displaystyle j}
. Then it fixes an
m
{\displaystyle m}
and tries values of
i
{\displaystyle i}
in the right-hand side of the congruence above, in the manner of trial multiplication. It tests to see if the congruence is satisfied for any value of
j
{\displaystyle j}
, using the precomputed values of
α
j
{\displaystyle \alpha ^{j}}
.
The algorithm
Input: A cyclic group G of order n, having a generator α and an element β.
Output: A value x satisfying
α
x
=
β
{\displaystyle \alpha ^{x}=\beta }
.
m ← Ceiling(√n)
For all j where 0 ≤ j < m:
Compute αj and store the pair (j, αj) in a table. (See § In practice)
Compute α−m.
γ ← β. (set γ = β)
For all i where 0 ≤ i < m:
Check to see if γ is the second component (αj) of any pair in the table.
If so, return im + j.
If not, γ ← γ • α−m.
In practice
The best way to speed up the baby-step" target="_blank">step giant-step" target="_blank">step algorithm is to use an efficient table lookup scheme. The best in this case is a hash table. The hashing is done on the second component, and to perform the check in step" target="_blank">step 1 of the main loop, γ is hashed and the resulting memory address checked. Since hash tables can retrieve and add elements in
O
(
1
)
{\displaystyle O(1)}
time (constant time), this does not slow down the overall baby-step" target="_blank">step giant-step" target="_blank">step algorithm.
The space complexity of the algorithm is
O
(
n
)
{\displaystyle O({\sqrt {n}})}
, while the time complexity of the algorithm is
O
(
n
)
{\displaystyle O({\sqrt {n}})}
. This running time is better than the
O
(
n
)
{\displaystyle O(n)}
running time of the naive brute force calculation.
The baby-step" target="_blank">step giant-step" target="_blank">step algorithm could be used by an eavesdropper to derive the private key generated in the Diffie Hellman key exchange, when the modulus is a prime number that is not too large. If the modulus is not prime, the Pohlig–Hellman algorithm has a smaller algorithmic complexity, and potentially solves the same problem.
Notes
The baby-step" target="_blank">step giant-step" target="_blank">step algorithm is a generic algorithm. It works for every finite cyclic group.
It is not necessary to know the exact order of the group G in advance. The algorithm still works if n is merely an upper bound on the group order.
Usually the baby-step" target="_blank">step giant-step" target="_blank">step algorithm is used for groups whose order is prime. If the order of the group is composite then the Pohlig–Hellman algorithm is more efficient.
The algorithm requires O(m) memory. It is possible to use less memory by choosing a smaller m in the first step" target="_blank">step of the algorithm. Doing so increases the running time, which then is O(n/m). Alternatively one can use Pollard's rho algorithm for logarithms, which has about the same running time as the baby-step" target="_blank">step giant-step" target="_blank">step algorithm, but only a small memory requirement.
While this algorithm is credited to Daniel Shanks, who published the 1971 paper in which it first appears, a 1994 paper by Nechaev states that it was known to Gelfond in 1962.
There exist optimized versions of the original algorithm, such as using the collision-free truncated lookup tables of or negation maps and Montgomery's simultaneous modular inversion as proposed in.
Further reading
H. Cohen, A course in computational algebraic number theory, Springer, 1996.
D. Shanks, Class number, a theory of factorization and genera. In Proc. Symp. Pure Math. 20, pages 415—440. AMS, Providence, R.I., 1971.
A. Stein and E. Teske, Optimized baby step" target="_blank">step-giant step" target="_blank">step methods, Journal of the Ramanujan Mathematical Society 20 (2005), no. 1, 1–32.
A. V. Sutherland, Order computations in generic groups, PhD thesis, M.I.T., 2007.
D. C. Terr, A modification of Shanks’ baby-step" target="_blank">step giant-step" target="_blank">step algorithm, Mathematics of Computation 69 (2000), 767–773. doi:10.1090/S0025-5718-99-01141-2
References
External links
Baby step" target="_blank">step-Giant step" target="_blank">step – example C source code
Kata Kunci Pencarian:
- Daftar algoritme
- SAS (grup musik)
- Justin Bieber
- AKA (grup musik)
- Louis Gossett Jr.
- George Cleveland
- Dido (penyanyi)
- Daftar diskografi, filmografi, dan bibliografi JKT48
- Harry C. Bradley (pemeran)
- Christopher McDonald
- Baby-step giant-step
- Pohlig–Hellman algorithm
- Giant Step
- BSGS
- Discrete logarithm
- Karatsuba algorithm
- Sieve of Eratosthenes
- Counting points on elliptic curves
- AKS primality test
- Williams's p + 1 algorithm