Elixir Quiz

Weekly programming problems to help you learn Elixir

Caesar Cipher

Welcome to the eleventh edition of Elixir Quiz. This week we will be encrypting a piece of text using a simple Caesar Cipher.

What is a Caesar Cipher

The Caesar Cipher is one of the simplest encryption methods.

It is named after the famous Roman general and statesman Julius Caesar. Caesar used the technique in his reign as Roman general, in which he used a cipher with a left-shift of 3 to hide the contents of his military messages.

Another famous Caesar Cipher is known as ROT13, in which the text is shifted by 13 characters. This was popular in the early days of the internet, to hide spoilers on Usenet forums.

The cipher is extremely insecure, as it is susceptible to frequency analysis attacks.

The problem

Create a function that takes a piece of plain text (either in a string, or as a path to a file), as well as a number, and performs a shift of that many places on the text.

As a stretch goal, see if you can reduce the time taken to encrypt large pieces of text by encrypting sections of it in parallel.

How do I enter?

The Caesar Cipher quiz runs from Saturday October 18th 2014 until Friday October 24th, 2014.

To enter, just complete the problem and post the code to our subreddit. As always, you can host your code anywhere (like Github Gists), or post your solution directly into the subreddit post.

Example solutions

After the quiz period ends on October 24th, I will update this section and talk about some interesting solutions that were posted to our subreddit