(S)Caesar Cypher Encryption

GITHUB: https://gist.github.com/NotOPSheel/727ffde02efeeb08c8366896076864b6

  1. What encryption method have you chosen, why did you choose it?

Caesar Cipher is a very simple substitution type cipher that was invented by Julius Caesar. This encryption algorithm translates each letter in the string a fixed number of positions in the alphabet. Then the encrypted message is decrypted by translating in the opposite direction. I chose to create a Caesar Cipher because I felt that there was a lot of potential to use what I have learned so far.  I also believed that this would be a difficult task for me, and it would push my understanding. Making the Caesar Cipher,  I gained a lot of new knowledge, and I was able to apply my learnings from class.

         2. What are the pros and cons of this encryption method?

Pros:

-Very simple to use

-no machines are needed to decode

-Key is simple and is easy to communicate to others

Cons:

-The Caesar Cipher algorithm worked well a long time ago, but it fails to conceal many important characteristics of the message.

-There are only 26 possibilities

-Very easy to decode

 Flowchart:

 

           4. What have you learned in this project and how does it connect with the topics we covered? (String operations, arrays, loops…)

This project was a huge learning experience for me, as I got the chance to apply my learning from class. I knew of String operations and arrays before beginning the project, however I was not sure of how I could apply these concepts to an actual program and use them effectively. Through this project I faced many difficulties, but I learned a great deal. My first problem was understanding how I would approach the encryption method. There are many different ways to reach a solution in programming, and some ways are more efficient than others. I struggled to figure out how I would start, so I began to do some research about how other programmers approached encrypting with a Caesar Cipher. The way I did it was by using a for loop with parameters that make whats in the for loop go through each character in the word inputted. These for loops were something that I did not fully understand before, but after using it my project, the use of for loop is much more clear to me. Before beginning this project we learned about the String class and it’s different methods such as .charAt(), and  .length(). I understood how the String class method worked before beginning the project, but I used these methods throughout my program to make my encryption loop through every character in the string. Programming the Cipher and applying my knowledge really helped to understand the importance of the String class and the String class methods.  Another great difficulty for me was figuring out how I could make the encrypted code range only of characters a-z. I did a lot of research, and tried  many things like using an array with the alphabet and restricting the encryption to the array.  In the end, I realized that if you subtract the key from 26(number of letters in alphabet), you would get the same result as if you were to go back to ‘a’ after ‘z’.  My greatest struggle in my programming process was the decryption. I understood that I simply needed to reverse my encryption algorithm, but even when reversed, the spaces would not show for my decrypt.  I am still not sure what it is that is wrong, as it seems to be the exact reverse of my encrypt that works perfectly fine. In total, I felt that this project was perfect for practicing array, String class, and loops. I enjoyed this project as I felt really excited after I finally got something to work after a long time trying different things. My understanding was greatly deepened and I am very proud of my program.

 

Citations:

Caesar cipher – pros and cons -Lorenzo.Grp3.1b

https://stackoverflow.com/questions/16458564/convert-character-to-ascii-numeric-value-in-java

https://stackoverflow.com/questions/18581531/in-java-how-can-i-determine-if-a-char-array-contains-a-particular-character

https://stackoverflow.com/questions/21412148/simple-caesar-cipher-in-java

Leave a Reply

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