Question: C++ RSA PROGRAM This c++ program must randomly find two unique prime numbers and must assure that numbers are prime It should perform the calculations

C++ RSA PROGRAM

This c++ program must randomly find two unique prime numbers and must assure that numbers are prime

It should perform the calculations to create the public and private keys. The calculations are as follows:

1. Choose two prime numbers. (In the real algorithm, you would choose extremely large prime numbers which, in itself, canbe a challenge.) For this problem, choose prime numbers that are less than 100. Call these numbers p and q.

2. Calculate n = p q

3. Calculate the totient t, such that t=(p-1)(q-1)

4. Choose an integer e such that 1 < e< t and e and t have no common integer factors other than 1.

5. Compute d such that de 1 mod t. In other words, d e= 1 + an integer multiple of t.

6. The public key is the pair (e, n). The private key is the paid (d, n).

7. Encryption formula is: C= Pemod(n) Decryption formula is: P= Cdmod(n)

Must create two files, pub.key and priv.key. The two files should contain the two relevant numbers separated by a space on a single line (e.g. 3 33) where 3 is dand 33is n. Thanks to anyone who answers!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!