# Examples of Encrypting with RSA

Suppose that P represents plain text. If we apply RSA encrpytion on P with the public information [n, e], we will obtain a C known as ciphertext. We are now going to give some examples of using RSA encryption to convert P to C, namely using the following congruence:

(1)Note that if we have the decryption key, we can also decrypt messages. Click here to see some example of RSA decryption.

## Example 1

**Given the public information [n, e] = [143, 11], encrypt the message P = 7.**

We know that $C \equiv P^e \pmod {n}$, more specifically $C \equiv 7^{11} \mod {143}$. Now we can solve for the ciphertext C:

(2)Hence if our plaintext P = 7, then when encrypted, our ciphertext C = 106.

## Example 2

**Given the public information [n, e] = [299, 17], encrypt the message P = 55.**

Once again we know that $C \equiv P^e \pmod {n}$, more specifically $C \equiv 55^{17} \pmod {299}$. We must now evaluate this congruence as follows:

(3)Hence our ciphertext C = 256.

## Example 3

**Given the public information [n, e] = [221, 19], encrypt the message P = 28.**

We know that $C \equiv 28^19 \pmod {221}$. Now let's solve this congruence:

(4)Hence our ciphertext C = 141.