### Introduction

In today's digital world, the security of our online communications is paramount. Whether you're shopping online, sending an email, or accessing your bank account, encryption ensures that your data remains private and secure. One of the most widely used encryption techniques is RSA (Rivest-Shamir-Adleman). Developed in 1977, RSA is a public-key cryptosystem that relies on the mathematical properties of prime numbers to secure data. In this three-part series, we'll explore the RSA process in detail, using simple prime numbers to illustrate how it works.

### What is RSA?

RSA is named after its inventors, Ron Rivest, Adi Shamir, and Leonard Adleman. It is a type of asymmetric encryption, meaning it uses two different keys for encryption and decryption. These keys are:

**Public Key:**Used to encrypt the data. This key can be shared openly.**Private Key:**Used to decrypt the data. This key is kept secret by the owner.

The security of RSA is based on the difficulty of factoring large numbers into their prime factors. Let's dive into the process of generating RSA keys and see how encryption and decryption work.

**The RSA Process:** Generating Keys and Ensuring Security

**Step 1: Choose Two Prime Numbers**

The first step in RSA is selecting two distinct prime numbers, π and π. These primes should be kept secret.

For our example, let's choose:

π=17

π=23

**Step 2: Compute π**

Next, we compute π, the product of π and π:

```
n= p Γ q
π= 17 Γ 23
π= 391
```

**Step 3: Compute the Totient Function π(π)**

The totient function, π(π), is calculated as:

```
Ο(n)= (pβ1) Γ (qβ1)
Ο(n)= (17β1) Γ (23β1)
Ο(n)= 16 Γ 22
Ο(n)= 352
```

**Step 4: Choose an Integer π**

We select an integer π such that 1<π<π(π) and gcdβ‘(π,π(π))=1. A common choice is π=3: gcdβ‘(3,352)=1

**Step 5: Compute π**

The final step is determining π*d*, the modular multiplicative inverse of π*e* modulo π(π):

```
d Γ e = 1 (mod Ο(n))
# Using the Extended Euclidean Algorithm, we find:
d=235
```

**RSA Keys Summary:**

```
Public Key: (e,n)=(3,391)
Private Key: (d,n)=(235,391)
```

With the keys generated, we're ready to see RSA in action with an example of encryption and decryption.

### Example in Action - Encrypting a Message

Let's encrypt a message π=42 using the public key (3,391).

**Step 1: Encryption**

The encryption formula is: πΆ=π^π (mod π)

For π=42*:*

```
πΆ=42^3 (mod 391)
πΆ=74088 (mod 391)
πΆ=74
```

Our encrypted message (ciphertext) is πΆ=74

**Step 2: Decryption**

Now, let's decrypt the ciphertext πΆ=74 using the private key (235,391).

The decryption formula is π=πΆ^π (mod π)

For πΆ=74:

```
π=74^235 (mod 391)
M=42
```

By calculating, we retrieve the original message: π=42

**Conclusion**

We've explored the RSA encryption and decryption process. From generating keys using prime numbers to encrypting and decrypting messages, RSA plays a crucial role in securing our digital communications. Understanding this process helps us appreciate the complexities and importance of modern encryption methods in protecting our data. Whether you're a student, a professional, or just a curious learner, grasping the basics of RSA provides valuable insight into the world of cryptography.