I just finished implementing the basics for RSA, but haven’t yet turned it into something that that can encode a stream of data. It just takes a single number and encodes it as another number.
The thing that worries me is in the Wikipedia article it says “He first turns M into an integer 0 < m < n”. I’m fairly certain this is wrong, but I’m hoping someone can verify that m cannot be 0 and it cannot be greater than or equal to n. Surely I can encode any number of bits of any value so long as it’s the same bit-length as n-was calculated to achieve (though of course it might not have)?
As noted under the section Padding Schemes in the Wiki article, there are weaknesses with the basic RSA algorithm due to its determinism and also issues with small plaintext value that need to be addressed. You should probably look into one of the padding algorithms mentioned in the article and see if you need them for your application.