Answered # Need help with making a RSA encryption program.

Moschops 683

0

I have been programming in C++ for a while now. I heard about RSA Encryption algorithm, and i have read many online sites on how it works. But i still cant grasp how the algorithm works. i have tried to make programs with RSA, but they doesnt encrypt.

If you could please explain the algorithm and how to use it in a program that encrypt files in c++ or c.

Thankyou...

:icon_neutral:

1

This is the exponentiation cypher, upon which RSA is based. Let's start with this.

Pick a prime number, p. Pick another prime number e (smaller than p), making sure that e and (p-1) are relatively prime.

Now, take your plaintext. Replace each letter by numerical equivalent (00 for A and 25 for Z would be one such method, for example - it's what I'll use, but if you want spaces and other symbols, you'll need something different) ending up with a two digit number for every letter.

Write these all out, and split them into blocks of length 2n (i.e. there are n letters in each block, and each block has 2n digits in). The number n is the largest possible integer such that the largest possible value of a block of length 2n is less than p.

i.e. if p is between 25 and 2525, then n would have to be one (such that the largest block value, which will be 2n long, which is two digits, is 25), and if p was greater than 2525 and less than 252525, then n would be 2 (making a largest block value, 2*n = 4 digits long, of 2525).

Take each of the blocks. Call a block P. The corresponding cypherblock is P^e (mod p).

This is the encryption side. When you've got that, I'll cover decryption :)

*Edited 4 Years Ago by Moschops*: n/a

This question has already been answered. Start a new discussion instead.

Recommended Articles

the function that I created to find the ...

Hi. so this is actually a continuation from another question of mineHere but i was advised to start a new thread as the original question was already answered.

This is the result of previous question answered :

code for the listbox - datagridview interaction

At the top of the code ...

Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.

btn_addline :

`Private Sub btn_addline_Click(ByVal ...`