The first approach of the algorithm , we random produce two prime numbers named p and q , Compute N = p * q note that N. Choose which should be less than N such that e and (p-1) (q-1) are relatively prime numbers. Public key is a pair of numbers (N, e). They should have no common factor other than 1. For example d is the decryption key, According to this algorithm (e*d) %( p-1) (q-1) = = = 1(identity sign), get d is the private key. Using the Euclidean algorithm to compute the modular inverse of e modulo N, the result is d. For example P is the ASCII code of a char in clear text. Then we take the RSA algorithm C = Pe % N. we can get C. Why chose python. Because there is a problem for the other language, big number operation but python can it directly. Main code: rsaEncrption.py N = p * q # two big prime number p and q d = 2 # d is the private key. it make the identic equation (e*d) % ((p-1)*(q-1)) === 1 while (e*d) %(p-1)*(q-1) != 1 d += 1 # public key : (N, e)