I want to make an encryption program that works like the banks(RSA), there is a public key and a private key to unlock the message after it is encrypted. The problem is that I am not very good at math and can't make sense of the tutorials on this out there. Could someone please explain the process in making the program and show some code samples to make it easier to understand. Please use small numbers to make the process easier to follow. Thank You in advance.
It boils down to finding two huge prime numbers, and doing math on the M (message) you're trying to encrypt, as if it was a number.
Could someone please explain the process in making the program and show some code samples to make it easier to understand.
I have a suggestion: try writing the program yourself, then when you get stuck post in General or Beginners for help. And if you're successful, you should consider publishing your program as an Article.
I downloaded a cryptography for dummies type pdf, I could send you if your interested or you could find it youself on a peer to peer thing havnt read it yet but I had a little fun scrambling code with an algorithm...i effed up at first tho... modulus and other things infinatley obfuscatify of whatever...havn't read it yet :D
@ Resident I highly doubt you need a math degree just to write an encryption program. Maybe if you wanted to write your own algorithm you would need a degree.
@OP The best thing you can do is read the article, and every term you do not understand you then research , continue recursively until you understand the whole article.
Then why reinvent the wheel? There's tons of free libraries out there that implement the RSA algorithm just fine. And not having any understanding of the math behind it is likely going to cause you problems when trying to implement it.
If it's for educational purposes, you'll need to understand the math behind it to actually gain anything. Otherwise you're just copying stuff from the Internet and not learning anything.
True, copying code often does not allow learning, but studying of that code can provide great insight and understanding. Plus the OP is mostly asking for help understanding the math, not for actual code.
Can someone just explain the RSA algorithm with actual numbers? I don't have much problems with math, but I don't understand what is what, for example I don't know what numbers to choose as my key. Can I use two primes like 5 and 7? 5*7 = 35 simple enough, 35 is my public key, what do I do with the public key after that? Use some simple examples, I just want to understand the logic behind it, the coding won't be that hard when I understand it.
naruko can you explain step 4) ? I don't understand how he came up with 5 as e? Is it the first number that does not have a common divisor with m above one?
It is a very nice website for learning to make an encryption program, thank you for the link.
ok that makes sense, and for 5) were does the numbers come from?
n = 0 => d = 1 / 5 (no)
n = 1 => d = 109 / 5 (no)
n = 2 => d = 217 / 5 (no)
n = 3 => d = 325 / 5
>Want to write encryption program.
>Not good at math.
Can't have both. Modern encryption is quite math intensive, and the people that write such things generally have degrees in math.
Math degree? That is why RSA encryption shines, its easy to use yet hard to crack. Everyone(interested in encryption) knows the mechanics but prime factoring high numbers takes so much computer power that it becomes a reliant method. To prove that anyone at any stupidity level can write a simple encryption program I made a program myself, based on the example from naruko's link.
Code: