RSA
RSA, is an example of asymmetric algorithms, or public key cryptography. Asymmetric algorithms rely on number theory. They use a math problem that would take a computer too long to solve. The security of the program is based on the length of the key. The keys used in modern cryptography are so large, that a billion computers working in conjunction with each processing a billion calculations per second would still take a trillion years to definitively crack a key.
The public-key cryptology (PKC) method, a user chooses two interrelated keys. He lets anyone who wants to send him a message know how to encode it using one key. He makes this key public. The other key he keeps to himself. In this manner, anyone can send the user an encoded message, but only the recipient of the encoded message knows how to decode it. Even the person sending the message doesn't know what code the user employs to decode it.

https://techiesphere.wordpress.com/2010/07/11/crypto-nerd-imagination/
How to use RSA:
Step 1: Create the Secret and Public Key
1. Choose two prime number.
p = 11, q = 3
2. Calculate n (p x q)
n = p x q
n = 3 x 11 = 33
3. Calculate z
z = (p-1) x (q-1)
z = (3-1) x (11-1) = 2 x 10 = 20
4. Choose a prime number, k, such that z is not divisible by k.
k = 7
5. n and k become the public key. This is the key the user will send to any party who wishes to send the user a private message.
6. Calculate j.
j x k = 1 mod z
j x 7 = 1 mod 20
j = 3
7. J is the secret key. This key is only for the user.
Step 2: Encrypt The Message
1. Encode the message
Pk = E mod n, where P is the original message, k and n are the public key and E is the encrypted message
P = 15
147 = E mod 33
E = 20
2. Send encrypted message.
Step 3: Decode the Message
1. Decode the message
Ej = P mod n, where E is the encrypted message, j is the secret key, P is the original message and n is the public key
203 = P mod 33
P = 14