The Gelfond - Shanks algorithm ( English Baby-step giant-step ; also called the algorithm of large and small steps ) - in group theory, the deterministic discrete logarithm algorithm in the mulplicative group of the residue ring modulo a prime number. It was proposed by the Soviet mathematician Alexander Gelfond in 1962 and Daniel Shanks in 1972 [1] [2] [3] .
The method theoretically simplifies the solution of the discrete logarithm problem, on the computational complexity of which many public-key cryptosystems are built. Refers to meeting methods in the middle .
Content
Scope
The discrete logarithm problem is of great interest for building public key cryptosystems . Cryptographic algorithms such as RSA , DSA , Elgamal , Diffie-Hellman , ECDSA , GOST R 34.10-2001 , Rabin and others are based on the assumption of extremely high computational complexity for solving this problem. In them, the cryptanalyst can get the private key by taking the discrete logarithm of the public key (known to everyone), and using it to convert the ciphertext into the message text. However, the more difficult it is to find it (the more operations you need to do to find the discrete logarithm), the more stable is the cryptosystem. One way to increase the complexity of the discrete logarithm problem is to create a cryptosystem based on a group with a large order (where the logarithm will take place modulo a large prime). In the general case, such a problem is solved by exhaustive search , the same algorithm allows in some cases to simplify finding the exponent (reduce the number of steps) when calculating modulo a prime number, in the most favorable case, by the square root of the times [4] , but this reduction is still not enough to solve the problem on a computer in a reasonable time (the question of solving the discrete logarithm problem in polynomial time on a personal computer remains open so far) [5] .
Discrete Logarithm Problem
Let a cyclic group be given with generatrix containing elements. Integer (in the range from before ) is called the discrete logarithm of the element on the basis of if the relation holds:
The discrete logarithm problem is given , to determine .
Formally, the discrete logarithm problem is posed as follows [6] :
provided that may not exist as well can be either a prime or a compound.
Theory
The idea of the algorithm is to choose the optimal ratio of time and memory , namely, in an advanced search for the exponent.
Let a cyclic group be given of order group generator and some element of the group . The problem comes down to finding an integer for which is executed
Gelfond - Shanks Algorithm Based on Representation as where , and brute force and . Restriction on and follows from the fact that the order of the group does not exceed , which means the indicated ranges are sufficient to obtain all possible from a half-interval . Such a representation is equivalent to equality
(one)
The algorithm precomputes for different values and saves them in a data structure that allows efficient search, and then iterates over all sorts of values and checks if corresponds to some value . Thus are the indices and which satisfy relation (1) and allow us to calculate the value [7] .
Algorithm
Entrance : Cyclic group of order generator and some element .
Output : Number satisfying .
- ←
- Calculate ← .
- For anyone Where < < :
- Write to the table ( , ) (see the section "Implementation")
- ← •
- For anyone Where ≤ < :
- Calculate .
- Check if contained in the table.
- If yes, return - .
- If not, continue to run cycle [1] [2] [7] .
Algorithm Justification
It is necessary to prove that the same elements in the tables necessarily exist, that is, there are such and , what . This equality holds in the case , or . At , the inequality holds . For different couples and we have , otherwise it would have turned out that with the indicated choice only possible if , and therefore . Thus expressions accept all values ranging from before which, due to the fact that , contains all possible values from before . So for some and equality holds [2] .
Algorithm Estimation
Let's say you need to solve where and - positive integers less . One way is to iterate over sequentially from before comparing the value with . In the worst case, we need steps (when ) On average, it will take steps. In another case, we can imagine as . Thus, the task is to find and . In this case, you can rewrite the task as or . Now we can iterate over all possible values on the right side of the expression. In this case, these are all numbers from before . These are the so-called big steps. It is known that one of the obtained values for - desired. We can write all the values of the right side of the expression in the table. Then we can calculate the possible values for the left side for various values . These are all numbers from before of which one is the desired one, and together with the correct value of the right part gives the desired result . Thus, the task is reduced to enumerating various values of the left side and searching for them in the table. If the desired value in the table is found, then we found , and therefore the corresponding . This illustration demonstrates the speed of the algorithm. Average performed operations. Worst case required operations [3] .
Example
Below is an example of solving a discrete logarithm problem with a small group order. In practice, groups with a higher order are used in cryptosystems to increase cryptographic stability .
Let it be known . First, create and fill in the table for the "big steps". Choose ← ( ) Then will pass from before .
| one | 2 | 3 | four | five | |
| 20 | 9 | nineteen | 12 | ten |
Find a suitable value for so that the values in both tables match
| one | 2 | 3 | four | |
| · | 15 | 6 | 7 | 12 |
It can be seen that in the second table for , this value is already in the first table. We find [2] .
Implementation
There is a way to improve the performance of the Gelfond-Shanks algorithm. It consists in using an effective table access scheme. The best way is to use a hash table . You should hash the second component, and then search for the hash in the table in the main loop by . Since accessing and adding items to the hash table works in time ( constant ), then asymptotically this does not slow down the algorithm.
The running time of the algorithm is estimated as which is much better than work time full enumeration of degree indicators [4] .
Features
- The Gelfond – Shanks algorithm works for an arbitrary finite cyclic group [7] [3] .
- No need to know group order in advance. The algorithm also works if Is the upper bound of the order of the group [7] .
- Usually the Gelfond-Shanks algorithm is used for groups whose order is a prime . If the order is a composite number , then the use of the Polyg – Hellman algorithm [7] is recommended.
- Gelfond - Shanks algorithm required memory. It’s possible to choose less in the first step of the algorithm. This increases the run time of the program to . It is also possible to use the Pollard ρ-method for discrete logarithm , which works for the same time, but requires a small amount of memory [7] .
Notes
- ↑ 1 2 D. Shanks. The infrastructure of a real quadratic field and its applications. Proceedings of the Number Theory Conference. - University of Colorado, Boulder ,, 1972. - S. pp. 217-224. .
- ↑ 1 2 3 4 I.A. Pankratova. Number-Theoretical Methods in Cryptography: A Training Manual. - Tomsk: TSU, 2009 .-- S. 90-98. - 120 s. .
- ↑ 1 2 3 V.I. Nechaev. Elements of cryptography. Fundamentals of information security theory. - M .: Higher School, 1999. - S. 61-67. - 109 p. - ISBN 5-06-003644-8 . .
- ↑ 1 2 DC Terr. A modification of Shanks' baby-step giant-step algorithm . - Mathematics of Computation. - 2000. - T. 69. - S. 767–773. .
- ↑ Vasilenko O. N. Number-theoretic algorithms in cryptography . - Moscow: ICMMO, 2003 .-- S. 163-185. - 328 p. - ISBN 5-94057-103-4 . .
- ↑ Yan, Song Y. Primality testing and integer factorization in public-key cryptography . - 2. - Springer, 2009 .-- S. 257-260. - 374 p. - ISBN 978-0-387-77267-7 . .
- ↑ 1 2 3 4 5 6 Glukhov M. M, Kruglov I. A., Pichkur A. B., Cheremushkin A. V. Introduction to number-theoretic methods of cryptography. - 1st ed .. - St. Petersburg: Doe, 2010 .-- S. 279-298. - 400 p. with. - ISBN 978-5-8114-1116-0 . .
Literature
- A.O. Gelfond, Yu.V. Linnik. Elementary methods in analytic number theory. - M .: Fizmatgiz, 1962 .-- 272 p.