Greatest common divisor
Given two integers and , with , we say that divides if and integer such that the following equality is satisfied:
If that exists, then we write , otherwise .
Despite we are used to consider the concept of division fairly simple, it plays a fundamental role in modern cryptography and it deserve additional attention.
Let be three integers:
- If and
- If and
- If and and
Amongst all the divisors that are in common between two numbers, we are particularly interested in the greatest common division.
Let be two integers, we define the greatest common divisor as the largest integer such that:
The greatest common divisor between two numbers is commonly written as.
When the , then we say that the two numbers are relatively prime.
Is it possible to compute efficiently the using the method of long division, also called the Euclidean algorithm. To understand how the algorithm works, it is useful to consider the generic division form between two numbers:
In this case, is called the quotient, and is the reminder. With this equation, we can present an equality used in the next theorem:
This equality states that the greatest common divisor between two numbers, is equal to the greatest common divisor between the lowest of the two, and the reminder of their division.
Let and two positive numbers in such that . We can compute the in a finite number of steps with the following algorithm:
- Let , , and set .
- Divide by to get the quotient and the reminder ;
- We have to situations here:
-
If the reminder is equal to zero, we terminate with:
-
Otherwise, we set and go back to point 2.
-
From the application of the Euclidean algorithm, we can obtain another important theorem for cryptography, which allows us to write the as a linear combination of and .
Let and two positive numbers in . The following combination has always a solution with and in :
An interesting alternative formulation of the same equation, is the one for relatively prime numbers:
Before we mentioned that we have an algorithm to compute the efficiently. But, what does it mean to compute something in an efficient way?
The Euclidean algorithm has complexity since it is possible to demonstrate that , so every two steps we have a reduction by half.
The fast powering algorithm
TODO
References
- Hoffstein, Pipher, Silverman, An Introduction to Mathematical Cryptography, Chapter 2