Skip to main content

Binary Euclidean Algorithm

  • Reference work entry
Encyclopedia of Cryptography and Security

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

structure 2_0-387-23483-7_26 structure 2_0-387-23483-7_26

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

References

  1. Bach, E. and J. Shallit (1996). Algorithmic Number Theory, Volume I: Efficient Algorithms. MIT Press, Cambridge, MA.

    Google Scholar 

  2. Brent, R.P. (1976). “Analysis of the binary Euclidean algorithm.” Algorithms and Complexity, ed. J.F. Traub. Academic Press, New York, 321–355.

    Google Scholar 

  3. Jebelean, T. (1993). “Comparing several gcd algorithms.” 11th IEEE Symposium on Computer Arithmetic.

    Google Scholar 

  4. 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.

    Chapter  Google Scholar 

  5. Knuth, D.E. (1997). The Art of Computer Programming, Volume 2: Seminumerical Algorithms (3rd ed.). Addison-Wesley, Longman Publishing Co., Inc., Reading, MA.

    Google Scholar 

  6. Menezes, A.J., P.C. van Oorschot, and S.A. Vanstone (1997). Handbook of Applied Cryptography. CRC Press, Boca Raton, FL.

    MATH  Google Scholar 

  7. Sorenson, J. (1994). “Two fast gcd algorithms.” Journal of Algorithms, 16 (1), 110–144.

    Article  MATH  MathSciNet  Google Scholar 

  8. Stein, J. (1967). “Computational problems associated with racah algebra.” Journal of Computational Physics, 1, 397–405.

    Article  MATH  Google Scholar 

Download references

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics