Utiliser le Extended Euclidean Algorithme
Extended GCD finds x, y such ce ax + par = gcd(un, b). Essential pour modular inverses et le Chinese Remainder Theorem.
- 1
The Extended Euclidean Algorithm computes gcd(a, b) and finds Bézout coefficients x, y such that a*x + b*y = gcd(a, b). If gcd(a, b) = 1, then x is the modular inverse of a mod b (a*x ≡ 1 mod b). This is used in RSA (d = e^(-1) mod φ(n)), CRT, and solving linear Diophantine equations.
- 2 Calculatrice de PGCD →
Calculer the GCD and Bézout coefficients. Enter a and b — the tool returns gcd(a,b), x, and y where a*x + b*y = gcd. Verify: if gcd = 1, then x mod b is the modular inverse of a mod b.
- 3 Inverse modulaire →
Calculer the modular inverse directly. Given a and m, find a^(-1) mod m such that a * a^(-1) ≡ 1 mod m. The inverse exists if and only if gcd(a, m) = 1. This uses the Extended GCD internally.
Questions fréquentes
- When does a modular inverse exist?
- a has an inverse mod m if and only if gcd(a, m) = 1 (a and m are coprime). If gcd(a, m) > 1, no inverse exists. For prime m, every non-zero element has an inverse. For composite m, only elements coprime to m have inverses — there are φ(m) such elements.
- How is Extended GCD used in RSA?
- RSA key generation: choose e (public exponent, typically 65537), compute d = e^(-1) mod φ(n) where φ(n) = (p-1)(q-1). d is the private exponent, computed using the Extended GCD: find d, k such that e*d + φ(n)*k = 1, then d mod φ(n) is the private key.