The principles behind this algorithm were discovered by R. Silver and J. Tersian and independently by Stein [8]. The algorithm computes the greatest common divisor and is based on the following observations:
If u and v are both even, then \(\gcd(u,v) = 2 \gcd(u/2, v/2)\);
If u is even and v is odd, then \(\gcd(u,v) = \gcd(u/2, v)\);
Otherwise both are odd, and \(\gcd(u,v) = \gcd(|u-v|/2, v)\).
The three conditions cover all possible cases for u and v. The algorithm systematically reduces u and v by repeatedly testing the conditions and accordingly applying the reductions. Note that the first condition, i.e., u and v both being even, applies only in the very beginning of the procedure. Thus, the algorithm first factors out the highest common power of 2 from u and v and stores it in g. In the remainder of the computation only the other two conditions are tested. The computation terminates when one of the operands becomes zero. The algorithm is given as follows.
The Binary GCD Algorithm
References
Bach, E. and J. Shallit (1996). Algorithmic Number Theory, Volume I: Efficient Algorithms. MIT Press, Cambridge, MA.
Brent, R.P. (1976). “Analysis of the binary Euclidean algorithm.” Algorithms and Complexity, ed. J.F. Traub. Academic Press, New York, 321–355.
Jebelean, T. (1993). “Comparing several gcd algorithms.” 11th IEEE Symposium on Computer Arithmetic.
Jebelean, T. (1993). “A generalization of the binary gcd algorithm.” Proceedings of the 1993 International Symposium on Symbolic and Algebraic Computation. ACM Press, New York, 111–116.
Knuth, D.E. (1997). The Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd ed.). Addison-Wesley, Longman Publishing Co., Inc., Reading, MA.
Menezes, A.J., P.C. van Oorschot, and S.A. Vanstone (1997). Handbook of Applied Cryptography. CRC Press, Boca Raton, FL.
Sorenson, J. (1994). “Two fast gcd algorithms.” Journal of Algorithms, 16 (1), 110–144.
Stein, J. (1967). “Computational problems associated with racah algebra.” Journal of Computational Physics, 1, 397–405.
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 International Federation for Information Processing
About this entry
Cite this entry
Sunar, B. (2005). Binary Euclidean Algorithm. In: van Tilborg, H.C.A. (eds) Encyclopedia of Cryptography and Security. Springer, Boston, MA . https://doi.org/10.1007/0-387-23483-7_26
Download citation
DOI: https://doi.org/10.1007/0-387-23483-7_26
Publisher Name: Springer, Boston, MA
Print ISBN: 978-0-387-23473-1
Online ISBN: 978-0-387-23483-0
eBook Packages: Computer ScienceReference Module Computer Science and Engineering