You have gotten an internship at the latest, trendy startup: The CryptoCorgiCompany. Your new senior colleague is friendly, but also a little naive. On your first day, you are given an enthusiastic explanation about the company’s new Secure Communication Protocol that you will help implement for their mobile chat application.

“You see, we made up our own algorithm so that no one else would know how it works. As long as we keep it secret, no one can possibly crack our code!”

In the back of your mind, that doesn’t sound right to you. If one person can figure out the algorithm, surely another can too, right? Still, internships can be hard to get, and it’s a good chance to learn more about encryption, so you decide to give them a chance.

The Four Functions

In this project, you are going to create a program that will encrypt, decrypt, and hash text. This will be essential for Ada’s new Crypto Corgi Company!

Your first goal is to define the encrypt_text function, which consumes a string representing a user’s message, and produces an encrypted version.

You will also need to define the decrypt_text which consumes the encrypted version and produces the user’s message.

Third, you need to define the hash_text which consumes a message and produces a unique hash. The hash is a way to convert text to a number that is likely to be unique for each possible string. If someone has tampered with the message, the hash value will be different from what was given.

Finally, you’ll put it all together into a single main program! This will be a user interface for people who want to use your other functions.

Function Signatures

Over the course of this project, you will define the following four functions:

Quizzes and Tests

Prior to writing these functions, there are some readings and quizzes that will help. The answers to the quizzes will be your unit tests for the project!

Decomposition

All three functions have a lot of operations in common. We strongly recommend you make at least three helper functions:

If you complete these three helper functions, then the remaining functions are all much easier.