## Computing Math Using Python: RSA Cryptosystem ( 1 of 2)

One of the courses that I am currently taking is computing math with Python.

Easy part: I have learned various mathematical theorems and methods.

Hard part: It would have to be transferring my knowledge to Python code.

The current topic of the week is RSA Cryptosystem which is  a very interesting subject. It involves encrypting  and decrypting code.

Here are the following conditions that required for the code:

Public and Private Keys

1. Pick two prime numbers.
• p and q are considered as prime numbers. It is recommended to use huge values. (I started out small in the beginning by have p = 2 and q = 7.)
2. N will be the value provided after multiplying p and q.
3. Determine Φ(N).
• Instead of going through the process of finding the coprimes, the easier method to use is (p – 1)(q – 1) = Φ(N).  When having to use huge primes, this will lessen the process.

Encryption

1. Determine the value for e (this is for encryption).
• To finding eit involves two conditions as well.
• The  value of e cannot be less than 1 or more than Φ(N). ( 1 < e < Φ(N) )
• It requires to be coprimes with both N and Φ(N).
• Public key  = (e, N)

Decryption

1. Determine the value for d (this is for decryption).
• This process requires to actually choose the value for d and also using the modulus of Φi(N):  (d*e)( mod Φ(N).
• Private key = (d, N)

Math Results (Knowledge Part):

• p = 2 and q = 7
• N = (2)(7) = 14
• Φ(N) = (p – 1)(q – 1) = (2 – 1)(7 – 1) = 6
• Finding e:
• 1 < e < Φ(N) —> 1 < e < 6: The range  is [  1, 2, 3, 4,  5 ].
• The even numbers had to be excluded due to their relationship with N.
• The number 1 is not included due to being able to divide any number.
• Need to be coprime for both N and Φ(N) which will be 5.
• The number 3 was excluded to have a relationship with Φ(N).  3 divides 6 or another way 3|6.
• My public key is  (e, N) which is (5, 14). This is also part of my encryption that will discussed later.
• Choosing the value of d:
• (e * d)(mod Φ(N)) = 1  or 5d mod 6 = 1. By using this method, we will choose 11 to be d.
• My private key is (d, N) which is (11, 14).

The internet has no limitations to whatever knowledge that you are seeking. It could be from learning code to finding open source projects. There so many resources and intelligent individuals out there. In the end, I started to experience….

The Problem

My current issue is the information overload. I was not pacing myself which was making me more and more impatient each day.

I wanted to dig in to to open source projects and learn as I go.

The Solutions

Nas once stated in an interview that made me think of  my learning curve. Basically, to enjoy the process of becoming better and not rush it.

So, I started taking a SAS Essential course to get a better understanding before moving on to SQL.

Also, I downloaded a Python game that I use from time to time.

I am taking my time to retain what I am learning throughout my process.

## Data Here, Data There, Data Everywhere! So I decided to learn about data science. I beg to ask just a few questions: What? Where? How? When?

I love that times have changed. So many resources to choose from and so little time. To be honest, I’m just trying to figure out what path to take to learning data science. How does the term goes? Sky’s the limit?

Podcasts. Check.

Books. Check.