Self Improvement

Self improvement is a journey that requires dedication, hard work, and a willingness to challenge oneself. It is a process of becoming the best version of ourselves, and it requires us to take…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Your first simple Encryption Algorithm

I first got to understand encryption in college, very simply put it helps you hide stuff until a key is provided. Much like a lock in your brain that allows you to share your secrets with people only after they have given a key (trust in this case) that it is safe to share this info with them

Since this is you’ve been click baited, let me define a few terms to kickstart. Please note these are for intuition purposes only.

In this article however, We will be exploring Symmetric key encryption. (Ofc the simplest, im noob.)

Lets start by setting up our tools. We will be using something you’ve heard of but probably never applied Fibonacci Sequence.

A Fibonacci Sequence is one where the first two values of the sequence are 0 and 1 and the next term is always the sum of previous two terms.

To show the sequence:

0, 1, 1, 2, 3, 5, 8 ,13, 21 . . . . So on.

The third term “1” is sum of 0 and 1
The fourth term “2” is sum of 1 and 1 . . You get the point.

This one is a little easier to understand. Assume you had a sequence of numbers, you arrange them to the best of your abilities in a square. Example

If i were to switch the 0th Column and 1st Column and rewrite the sequence in a straight line (row wise, left to right) We would get 2, 1, 4, 3

We’ll be using python, because why complicate coding when we need to understand the concept.
Libraries used:
1. math
2. random
3. time

We use the “0” in the finalLengths to be able to extract the original key (not the best way, but this is just to help understand!

Our fibonacci Generator:

We’ll also define a function to help us exchange columns of given indices:

The decrypt function is extremely similar to the encrypt with one change in logic, we reverse the steps we followed during encrypting for column change.
Example:

If we did (during encrypt):

Then we do(during decrypt):

1. exchange column 2 and 4

2. exchange column 1 and 3

Initial:

The format of the key:

Exchange 0 and 2:

Exchange 2 and 1:

Exchange 0 and 1:

Third Switch

Now Reading as a string: “HLELYOOXU” (Encrypted)

So for example we get the key:

Exchange 1 and 0:

First switch

Exchange 1 and 2:

Second Switch

Exchange 2 and 0:

Add a comment

Related posts:

How to see if I have assets or liabilities?

Our definition of an asset is still one that we use today: How to see if I have assets or liabilities? If you stopped working today, meaning the salary stopped, from where would money flow into our…

Millimeters to Centimeters Calculator

Convert Millimeters to Centimeters online using the calculator below:. “Millimeters to Centimeters Calculator” is published by MM In Inches.

Natural Disaster

Natural Disasters are the happenings that take place due to the abrupt changes of the nature that remain beyond human control. The word natural disaster is so terrifying that even when it is heard by…