How to convert RSA public keys to one key to use for text hashing? I've recently asked a question about RSA encryption. One of the things that I don't understand is the usage of two public keys.

In the example on Wikipedia, a message is encrypted like:

c(m) = m ^ e % n


This means that I need e and n to do an encryption. Also, in the article m is defined as plaintext but represented as an integer.

My two questions are:


How do I combine e and n to be one public key?
How should plaintext be formatted to be used in the Wikipedia example?


PS: RSA public key generation is based on this Wikipedia article.

PPS: Here is an example of an online RSA generation tool, I don't understand how those hashes are created based on the Wikipedia example.
An RSA public key is made of 2 parts, the modulus n and the exponent e.  They are both required, and neither alone can be considered "the key".  Often e will be one of just a few different values, but this is mostly convention and shouldn't be assumed.

RSA does work on integers; if your data is of another form, you have to specify how to convert it.  For instance, if you have text you might encode it to a byte array with UTF-8, then take blocks of bytes such that the number if bits is less than the length of n, and then treat that byte array as one big integer (either little-endian or big-endian).

But you probably don't want to be doing this math yourself, and there are a lot of pitfalls (padding, etc) to trap the unwary.  You should be using a library that someone has already implemented.