RSA (Rivest-Shamir-Adleman) is a widely-used public-key encryption algorithm. It relies on the practical difficulty of factoring the product of two large prime numbers, the "factoring problem", to secure communications. This implementation relies on, extended_euclidean and mod_exp from the number-theory codebase.
This algorithm uses a couple of different variables \( N = pq \) where \( p \) and \( q \) are large primes. Then, \( e \) and \( d \) where \( de \equiv 1 \mod (p-1)(q-1) \). Finally, \( m \), which represents the message, and \( c \) which represents the ciphertext.
To encrypt the message \( c \equiv m^e \mod N \)
To decrypt the ciphertext \( m \equiv c^d \mod N \)