VnabpP23 / RSA-implementation_IN_Python

This is a RSA implementation in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python-RSA Implementation

  1. Prime Number Selection:

Two large prime numbers, let's call them "P" and "Q," are carefully chosen. They should be distinct from each other and ideally have a similar number of digits in their binary representation.

  1. Computation of N: These prime numbers are multiplied together to form a new, even larger number, which we'll refer to as "N." This number serves as a cornerstone for both the public and private keys.

  2. Totient Calculation: A special value called the "totient" of N, denoted by the Greek letter phi (πœ‘), is calculated using the formula: πœ‘(𝑛) = (P-1) * (Q-1). This totient plays a crucial role in finding the private key.

  3. Choosing the Public Exponent: An integer called "E" is selected as the public exponent. It must meet two conditions: It must be coprime with the totient πœ‘(𝑛), meaning they have no common divisors other than 1. It must be greater than 1 but less than N.

  4. Determining the Private Exponent: The private exponent, denoted by "D," is calculated using a special relationship with the public exponent E and the totient πœ‘(𝑛). The formula for finding D is: D * E ≑ 1 (mod πœ‘(𝑛)). This means that D, when multiplied by E and divided by πœ‘(𝑛), leaves a remainder of 1.

  5. Key Pair Formation: Now, the public key and private key are established: The public key consists of the pair (E, N). The private key consists of the pair (D, N).

About

This is a RSA implementation in python


Languages

Language:Python 100.0%