The Extended Euclidean Algorithm is an extension of the classical Euclidean Algorithm, which is primarily used for finding the greatest common divisor (GCD) of two integers. While the Euclidean Algorithm is efficient for determining the GCD, the Extended Euclidean Algorithm goes a step further by also finding the coefficients of Bézout's identity. These coefficients are integers
and
such that
. This property is particularly significant in the field of cryptography, especially in public-key cryptography, where it is used for key generation and other cryptographic operations.
The classical Euclidean Algorithm operates on the principle of repeatedly applying the division algorithm to pairs of integers. Given two integers
and
with
, the algorithm computes the GCD by performing the following steps:
1. Divide
by
to obtain a quotient
and a remainder
such that
.
2. Replace
with
and
with
.
3. Repeat the process until
becomes 0. The non-zero remainder at this stage is the GCD of
and
.
The Extended Euclidean Algorithm builds upon this by maintaining additional variables to track the coefficients
and
of Bézout's identity throughout the process. The steps of the Extended Euclidean Algorithm can be described as follows:
1. Initialize
,
,
, and
.
2. While
:
a. Compute the quotient
.
b. Update
and
using the Euclidean Algorithm:
.
c. Update the coefficients:
and
.
3. The GCD is now the value of
, and the coefficients
and
are
and
, respectively.
To illustrate this with an example, consider finding the GCD of 56 and 15, and the corresponding coefficients of Bézout's identity.
1. Initialize
,
,
,
,
, and
.
2. Compute
.
3. Update
.
4. Update
and
.
Repeating these steps:
1. Compute
.
2. Update
.
3. Update
and
.
Continuing:
1. Compute
.
2. Update
.
3. Update
and
.
Finally:
1. Compute
.
2. Update
.
3. Update
and
.
When
becomes 0, the GCD is the current value of
, which is 1. The coefficients
and
are 3 and -11, respectively, satisfying the equation
.
In the context of public-key cryptography, the Extended Euclidean Algorithm is instrumental in various cryptographic protocols. One notable application is in the RSA algorithm, where it is used to compute the modular multiplicative inverse. During the RSA key generation process, two large prime numbers
and
are selected, and their product
is computed. The totient
is also determined. A public exponent
is chosen such that
and
. The private exponent
is then computed as the modular multiplicative inverse of
modulo
, i.e.,
. The Extended Euclidean Algorithm is employed to find
efficiently.
For example, if
and
, the Extended Euclidean Algorithm is used to find
such that
. Applying the algorithm:
1. Initialize
,
,
,
,
, and
.
2. Compute
.
3. Update
.
4. Update
and
.
Continuing:
1. Compute
.
2. Update
.
3. Update
and
.
Finally:
1. Compute
.
2. Update
.
3. Update
and
.
When
becomes 0, the GCD is the current value of
, which is 1. The coefficient
is -17, and since we are working modulo 40, we take the positive equivalent
. Therefore,
is the modular multiplicative inverse of
modulo
.
The Extended Euclidean Algorithm's ability to compute these coefficients efficiently is a cornerstone in the implementation of many cryptographic systems. Its role in finding modular inverses is important for key generation, encryption, and decryption processes in asymmetric cryptography. The algorithm's efficiency and simplicity make it an indispensable tool in the cryptographer's toolkit.
Other recent questions and answers regarding EITC/IS/CCF Classical Cryptography Fundamentals:
- Is cryptography considered a part of cryptology and cryptanalysis?
- Will a shift cipher with a key equal to 4 replace the letter d with the letter h in ciphertext?
- Does the ECB mode breaks large input plaintext into subsequent blocks
- Do identical plaintext map to identical cipher text of a letter frequency analysis attact against a substitution cipher
- What is EEA ?
- Are brute force attack always an exhausive key search?
- In RSA cipher, does Alice need Bob’s public key to encrypt a message to Bob?
- Can we use a block cipher to build a hash function or MAC?
- What are initialization vectors?
- How many part does a public and private key has in RSA cipher
View more questions and answers in EITC/IS/CCF Classical Cryptography Fundamentals

