Posts

Showing posts with the label gcd

Euclid's Algorithm to find greatest common divisior

Image
Greatest common divisor One integer often needed in cryptography is the greatest common divisor of two positive integers. Two positive integer may have many common divisor but only one greatest common divisor. For example, the common divisor of 12 and 140 are 1, 2 and 4. However, 4 is the greatest common divisor.       The greatest common divisor of two integers is largest integer which can divide both given integers. The following block diagram illustrate the basic of the greatest common divisor of 12 and 140. " Euclidean Algorithm " Finding the greatest common divisor ( GCD ) of two positive integers by listing all common divisor is not practical, when the two number integers are large. Fortunately, more than 2000 years ago a mathematician named Euclid develop an algorithm that can find the greatest common divisor of two positive integers. The Euclidean algorithm is based on the following two facts: 1. gcd ( a, 0 ) = a 2. gcd ( a, b ...