SmartNinja students competed in creating encryption software. Who won?
06 Jul 2020 Smart Ninja
Every month or so we organize a SmartNinja Challenge where students can compete in creating the best software projects.
For the May/June 2020 challenge, students needed to create a desktop program or a web application for using Caesar's cipher.
Caesar's cipher? What is that?
Caesar's cipher is a very simple way of encrypting data. It is named by the famous Roman emperor, Julius Caesar, who has used this method to prevent unwanted eyes from reading his messages.
Nowadays this method of encrypting data is obsolete and insecure, but back then (when few people could even read, let alone decipher a text), it was quite an effective method.
You might have used Caesar's cipher when you were in school, writing paper notes to your classmates. In order to prevent other classmates from reading your note, you have probably used Caesar's cipher - without even knowing you have used a method over 2000 years old!
How does Caesar's cipher work?
Let's say we'd like to encrypt this text: "hello".
In order to encrypt it, we will shift its letters by a certain number, let's say by 3 places. This means we will rotate the whole alphabet by three places.
In this case, A becomes D, B becomes E, C becomes F, and so on (at least in the English alphabet):
So our message "hello" will become "khoor".
The receiver of our message will have to know the number by which we shifted the alphabet (in our case 3). But this information must remain secret, only the sender and the receiver should know it. That's why we call this information a secret key.
Obviously, with such a basic encryption algorithm as Caesar's cipher, anyone could just try out all the possible combinations and figure out what the secret message is. This kind of an "attack" on the cipher is called a brute force attack (because we're trying out all possible combinations).
The challenge that our students needed to complete was to create a program that would do Caesar's cipher encryption for us (so that we don't have to do it manually).
The program can be either a desktop program or a web application.
Additional requirements were that the program needed to be written in Python (at least the part that implements the actual Caesar's cipher algorithm). Students needed to write the algorithm on their own, and not use some programming package (a pre-written chunk of code) that would do the encryption/decryption part. And the program needed to have a graphical user interface (GUI).
Two students got the best score and won the competition: Ben and Jake.
Ben attended our course Programming for beginners where he learned how to use a programming language Python and creating desktop applications.
That's why he developed a desktop program for this challenge using Tkinter for a graphical user interface.
The secret key (number) is selected with a slider. When you move the slider, the red line of letters above is also moving in real-time, thus giving you a nice overview of how letters are converted.
By clicking the Benigma checkbox, you can revert the whole process and instead of encrypting, the program starts decrypting a message.
The code of Ben's solution is accessible here on GitHub.
Jake has attended two of our courses: Web development 1 and Web development 2, that's why instead of a desktop program he created a web application.
The UI was done with the help of HTML and CSS, and the website is capable of nicely adapting to mobile screens (responsive design).
Big congratulations to both winners! 🎉 Stay tuned for new challenges on our GitHub account. 🤓