# Low level explanation of how a message is sent via RSA

I understand that RSA encryption uses this formula:

C = M^e (mod N)


public key is e and N

N is pq - p and q are private key.

mod N makes above function one-way - ie cannot be reversed. Hence given C, e and N, it is not possible (easily) to find M.

Basic idea is that modulo arithmetic on an exponent is a one way function.

The practical bit I am struggling on now is that M (the message) must be a number. How is the text eg "I love you" converted to a number. I am looking to understand the basic concepts but also in reality what scheme is used to create a number from the text. What are the options and what is generally used in practice? Please explain the mathematics as required.

You could take the byte stream of the text message above:

01001001001000000110110001101111011101100110010100100000011110010110111101110101


and treat as a LARGE binary number. I guess the numbers would get pretty large like this so probably not the way its done.

• Encoding is pretty trivial: E.g. it doesn't matter if you send two messages with 1 bit information each, or send one 2-bit message or a specific format with delimeters (e.g. $111b_10101010b_2000$). Regarding the answer, the according terms for these mechanics might be useful: hybrid encryption and as a practically used padding scheme RSA-OAEP – tylo May 15 '14 at 13:48