Encryption is one of the major topics that we covered in class, and one that is very widespread and useful. Anytime information is passed along in the internet, encryption is needed to prevent third parties from accessing private data. According to Wikipedia, encryption is the process of encoding a message or information in such a way that only authorized parties can access it and those who are not authorized cannot. Most websites and people use encryption to protect their data. Without it, everyone would be able to access everyone else's information.
There are many ways of encrypting data, from Caesar ciphers to the Diffie Hellman Key Exchange. All of these convert plaintext, or readable writing, to ciphertext, which is unintelligible to humans. These ways range from very easy for computers to decrypt, to almost impossible without the correct key.
The Caesar Cipher has been used for a very, very long time. Like its name suggests, it was possibly used by Julius Caesar when he wanted to communicate to his generals. The logic behind this is very simple: Change every letter to a different letter by moving down the alphabet a certain number of letters. This makes ordinary words and phrases turn into things unreadable. For example, the letter "A" turns into "B" and the sentence "The quick brown fox jumps over the lazy dog" turns into "Sgd pthbj aqnvm enw itlor nudq sgd kzyx cnf" when we change every letter to the next letter in the alphabet.
Shifting it by one is not the only way that you can encrypt data. You can shift it by any number. We differentiate the different numbers we shift by by saying ROT (short for rotation) and the number of letters we shifted by. The sentence I used as an example was encrypted using ROT1. To decrypt this, you can do another Caesar Cipher, but by using the negative ROT. If you change "Sgd pthbj aqnvm enw itlor nudq sgd kzyx cnf" using ROT-1, you get back, "The quick brown fox jumps over the lazy dog." ROT13 is an extremely popular Caesar Cipher because of its symmetry. Since the alphabet has 26 letters, ROT13 and ROT-13 do the exact same thing.
Frequency of each letter in the English Language
Despite its popularity, this form of encrypting is incredibly easy to decode. Even without a computer, people are able to decode it by hand. With a computer, you don't even have to know the ROT to decode it. Just by looking at the popularity of each letter in the passage, you can guess what the ROT is and test it out. For example, the most common letter in English is "E." If you find the most common or second most common letter in a passage, the odds are really high that they will be "E," and you will have cracked the cipher. Computers are also able to do this almost instantaneously, because of the low amount of computations and data needed.
Like the Caesar Cipher, the Vigenère Cipher is a form of encryption. It builds heavily off of the Caesar Cipher. This was invented in 1553 by Giovan Battista Bellaso but Blaise de Vigenère was later credited for it in the 19th century, which is why it is named that. This cipher requires a "key," in the form of a word or a phrase. This word or phrase is repeated over and over again until it is the same number of letters as the data you want to encrypt. You then place the repeated letters above the data and letter by letter, "add" them using a table. The "sum" of the two letters is the letter in the box in the first letter's column and the second letter's row.
This might be hard to visualize, so here's an example. Let's say that you wanted to encrypt the sentence, "COSMOS UCSC has been an amazing month, and I made a lot of friends there" and your "key" is "YOU KNOW." Here is how you would encode this:
This cipher is more advanced than Caesar Cipher, and is much harder to crack. Usually, you need the "key" to decrypt. but if the "key" is short, it is like solving many Caesar Ciphers, as many as the number of letters in the "key." This is relatively easy to decrypt using a computer program.
This isn't a way to encrypt, but rather a method of transmitting data without a third person able to read private info. It was conceptualized by Ralph Merkle and named after Whitfield Diffie and Martin Hellman. This method uses both public and private keys. Public keys are keys that you share with the public. Private keys are keys that you keep to yourself, much like a password. In this case, it is a number that the two parties that want to exchange information agree upon. This way of transporting information is much easier to visualize with an analogy.
Since we want the information to be easy to encrypt but hard to decrypt, pain is a great analogy. Paint is easy to mix but is hard to "unmix." When two parties, A and B want to communicate a color without a third person, C, knowing the color, this is what they do. First, they agree on a public key, a color that is broadcast to everyone and it doesn't contain any secret data. Each person has a private key, another color. A and B each mix their respective private paint with the public paint and then broadcast the result. When A gets B's result, they mix their private paint into the result, forming a new color with one amount from each of the following: A's private key, B's private key, and the public key. This mix is exactly the same for both of them, and is the data that they are trying to transfer. C, the middle man attacker, only has the two mixes. It would be very difficult to separate the paints and remix them. Therefore, it is almost impossible for C to breach the data between A and B.
Bringing this back into the realm of computer science, this way of transferring data can be applied to numbers. Instead of paint, A and B will use something called the discrete logarithm problem. When you take a number N and one of its primitive roots R, you can raise R to any random power, and the remainder mod N will have an equal probability of being any positive number less than N. N and R will be the public key and will be available to anyone. Person A then chooses a private key number, as does Person B. They use the number to raise R to that power and send that to the other person. The other person then raises that sent info to the power of their private key and compute the remainder mod N. This process leads to both A and B arriving at the same remainder, while the middle man attacker will have to take a lot of computational power to find the numbers that A and B used. With small numbers, it is definitely crackable, but the bigger the numbers are, the more time it would take for a middle man attacker to compute the private keys and the shared number.
Below is a video to further explain the Diffe-Hellman Key Exchange, if you want to learn more about it!