Lev Leetian
Lev Leetian

Reputation: 63

Implement RSA in Java without using Cipher

I'm trying to implement the RSA encryption/decryption algorithm on a text of String. However, everything I have found online either uses Cipher, or they are performing the algorithm on an integer. Could anybody give me a simple guide for implementing this on for example, a sentence? I prefer not to use Cipher or any other libraries because I want to know how it works.

Edit: Thanks for the help everyone. I finally got it to work :)

Upvotes: 0

Views: 1145

Answers (2)

Jordan Hochstetler
Jordan Hochstetler

Reputation: 1416

RSA all depends on the large prime numbers and how they are very hard to factor. For further knowledge on the subject I'm gonna give you two resources that will explain the algorithm in further depth. I would recommend writing down which variables/methods you will want to create in java to stay organized.

Here are resources:

YouTube Clip which Explains the premise of the algorithm: RSA Cipher Explained

More Interactive Slide Explanation: RSA Algorithm Slide Show

Upvotes: 0

Struchu
Struchu

Reputation: 76

The best thing for you to do would be to get fimiliar with the algorithm itself. Wikipedia has decent explanation on it. Then you need to implement modular operations. When you accomplish the above simply treat a message you want to encrypt as a number (rather big number in fact) and follow the operations described in wiki. A sentence (or any other character sequence) can be treated as a number as its just sequence of bytes.

Upvotes: 1

Related Questions