I know that it generates a public key and then a private key. You encrypt with public and can only decrypt with private key.

How is this algoritm going to work in a C++ program, how am i going to compute the public key and then the private key?

Also, once i have the keys. Do i xor the line to encrypt it or add or minus the key with the character value eg:


for(int i = 0; i < LineFromFile.size(); i++)
       encryptedLine = LineFromFile[i] ^ publickey[i];

LineFromFile is a line readed from a .txt file (the data that needs to be encrypted)

Or how do i do this?

4 Years
Discussion Span
Last Post by np complete

From what I know u should line to the power key modulus n and XOR is not used


RSA takes the private key from user. Now it searches the directory for the user who will get your encrypted file. It takes his/her public key and encrypts. Algorithm uses modular arithmetic. The main challenge is to generate two large prime numbers (probably 100 digits long, for security purpose).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.