1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! # Math Module
//!
//! This module provides fundamental algorithms from number theory,
//! commonly used in cryptography, modular arithmetic, and algebra.
//!
//! # Overview
//!
//! The module includes implementations for:
//!
//! - **Euclidean Algorithm**: Computes the greatest common divisor (GCD).
//! - **Bézout's Identity**: Finds coefficients that express the GCD as a linear combination.
//! - **Multiplicative Inverse**: Computes modular inverses using the extended Euclidean algorithm.
//!
//! # Use Cases
//!
//! These algorithms are essential in:
//!
//! - Cryptography (RSA, ECC, stream ciphers)
//! - Modular arithmetic systems
//! - Solving Diophantine equations
//! - Number theory applications
//!
//! # Mathematical Background
//!
//! Given integers `a` and `b`, Bézout's identity states:
//!
//! ```text
//! ax + by = gcd(a, b)
//! ```
//!
//! The multiplicative inverse of `a mod m` exists if and only if:
//!
//! ```text
//! gcd(a, m) = 1
//! ```
//!
//! # Modules
//!
//! - [`euclides`] - Implements the Euclidean algorithm for GCD computation.
//! - [`bezout`] - Computes Bézout coefficients using the extended Euclidean algorithm.
//! - [`multiplicative_inverse`] - Calculates modular inverses in ℤₙ.
//!
//! # Notes
//!
//! - All algorithms are deterministic and operate in logarithmic time complexity.
//! - Designed to be efficient and suitable for cryptographic contexts.