browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

Computer Science: Encryption

Posted by on April 13, 2019

How does it work?

I created my own encrypting method in this project rather than copying other existed encryptions. As I like mathematics, I utilized the Unicode of characters a lot. For example, the Unicode of A is 65. There are mainly three creative encrypting systems in my encryption.

  1. Primes Encryption
  2. Squares Encryption
  3. Even-Odd Encryption

 

1. Primes Encryption

First of all, prime numbers are the numbers that cannot be divided by only itself and 1. For example, number 7 only can be divided by 1 and itself, 7.

7/1 = 7 (integer, which indicates 7 is divisible by 1)

7/4 = 1.75 (decimal, which indicates 7 is NOT divisible by 4)

7/7 = 1 (integer, which indicates 7 is divisible by 1)

Even though a concept of prime numbers is easy, the prime number is actually tricky. There is any kind of computable formula or pattern of the prime number found until now, although mathematics have tried thousands of years. Thus, we cannot find which number is a prime number unless we divide that number with every possible number: if there is a no number that cannot divide the number except 1, that number is a prime number. This characteristic of prime numbers is widely used in the United States. In fact, the United States compensates around 2oo,000$ when finding new prime numbers for this reason. As a result, I decided to use the prime number in my encryption.

I first made a list of prime numbers that is between 65 to 122, which is the first letter, A, to the last letter, z. If the Unicode of a certain letter of a given statement is a prime number, I encode that letter by joining the letter of Unicode of that letter + the order of that letter in the prime list and the order of that letter in the prime list.

Lists

 

For example, if one writes down C, which has Unicode of the prime number, it is encoded as a letter that has Unicode of its + the order from the list and the order of that Unicode. C has the Unicode of 67 and it is a 12th number from the list. Thus, this will be encoded as O12. O has the Unicode of 79, which is C + 12.

In addition, if the Unicode of a letter of a given statement is not a prime number, my encryption encodes that letter as the letter that has Unicode of closest, but bigger than that number, prime number and the difference between the Unicode of a letter that has the closest prime number and a letter of given statement.

For example, if we write down A, it will be C2 since C is the closest number that has prime number-Unicode and 2 is the difference (Unicode of C, 67, – Unicode of A, 65 = 2).

2. Squares Encryption

This Encryption encodes the letter that has the Unicode of square numbers as its letter and the root number of the Unicode of that letter. For example, if we put Q, which has the Unicode of 81, the encryption gives me Q9. 9 is because of the root number of 81.

3. Even-Odd Encryption

Since the biggest prime number between 65 and 122 is 113, letters that have Unicode of greater than 113 cannot be encoded.

For these letters, I made this encryption. Simply, if the Unicode of the letter is even, encode this letter as the letter that has the Unicode of the sum of its Unicode and 3 and following by 3. Here, I used MODE to figure out which number is even. The code mode 2 = 0 shows whether the number is divisible by 2 or not, which is equal to even numbers. I used the “else” code to find odd numbers. I did the same pattern as even encryption except adding by 1 and following by 1. For instance, if we write down “rs”, it became “u3t1”. r became u3 since r has Unicode of 114, which is even, and s became t1 because has Unicode of 115, which is odd.

Which pattern did I use?

The main idea of my encryption is that if each letter of given statement meets certain condition – prime, square, even, and odd encryptions – change that letter with a modified letter and add a certain number. Therefore, the Filter Pattern was best-suitable for my encryption.

 

In addition, iterations are useful in my encryption since my encryption needs to filter each letter in the statement and encode.

Challenges

  1. Square Encryption’s interval includes Prime encryption’s interval. Thus, these encryptions both encode the statement, which makes a problem. To avoid this, I used “if and else” function. If & else separates prime and square encryptions. Since I used square encryption at the “if” part, the letter will first go through square encryption and check whether it meets square encryption’s condition or not. If the letter meets the square encryption, it follows square encryption’s code and if does not meet, if follows the functions at the else part, prime encryption. The letter also goes through prime encryption and follows its code. If that letter also does not meet prime encryption, the letter goes to the last codes, even-odd encryption. Prime encryptions have the interval between A to q, which are in Unicode interval between 65 to 113. Square encryption encodes only 3 letters, Q, d, and y, which all have the square Unicode. Therefore the rest of the letters cannot be encoded. Even-odd encryption encodes the rest letters.
  2. Since there was no formula for prime numbers, I struggled to create a code that finds prime numbers. Afterward, I just decided to make a list of prime numbers between 65 to 122, the first letter (A) to the last letter (z) because there are only a little number of prime numbers. Making a list enables me to build encryption easier.

Decoding

I simply reverse my the encryption but do not include the numbers after the letters. However, it takes a pretty long time since my encryption was long.

 

Success!!!

Leave a Reply

Your email address will not be published. Required fields are marked *