Time to step the game up. Now that we know about various codes and how to break them, lets a take a crack at designing our own two way encryption message system. It will be done using Python as the programming language, and will be a exchange between three parts of code, each acting as a seperate PC. How it will work is the first PC will send the message and whatever tags it might need to the second PC, and the third PC will intercept it in its packaged form. The second computer will decrypt the message, and write a response using a different form of the original cipher, again with the third computer picking up the packaged string. This will emulate an interception of data, with the third computer being the attacker. But first things first, we need to create a seed to be able to encrypt the message with. The seed will act as a small set of characters, (called the key) of which the computer can use to make a very big number to encrypt the message with, but only has to send the small seed to the other computer to keep the message short and to make it harder to decode. So, lets start on the string:
This is a small visualization of some code that will create a seed of 7 numbers, then print them. Now, I need to put this into code form.
Im sure there is an easier way to do this, but im doing like this because its the only way I understand, and it works. Alright, now the seed can be defined, we need to figure out how we are going to turn it into a key that we can use. To the board!
Heres my first attempt, I split the seed into a 5 number digit and a 2 number digit, then times the 5 number digit by itself however many times the 2 digit number is. So, for example, if my seed is 3781931, then I would seperate the numbers, 37819 and 31. Then I times 37819 by itself 31 times. The problem with this system is that it is excessively slow due to the massive amounts of calculation you have to do. So, I need something more efficient, that can be done quicker. time to try again.
Heres the second attempt. Overall its a mostly clean piece of code. It takes the seed, turns it into a decimal, then multiplies the original seed by it, then reverses the seed, turns that into a decimal, multiplies the sum of the last multiplication by it, removes the decimal and thats the key.
Heres it in code form, note that I changed the parts with .append because that function is used for lists, not strings. if you add them like you would an integer, but have both variables as a string, it will add it onto the end. Now that we have had it create a key from the seed, we need to figure out how we can encrypt something using a long list of numbers.
Heres the code with every step described to keep track of everything.
The Roadblock.
Now here comes the big problem; We have to decide on a way to encrypt our message using our system. The problem is, we need to choose very carefully because if the person can decode the messages, then they can figure out how the key is made and then they have easy access to all messages sent afterwards. So, rather than choose one encryption system for the message, I think im going to choose ten (0-9) and take the last number of the seed to determine which encryption is used. This might take a bit.