Rail Fence Cipher

Steph Leung on Flickr

A simple zigzag pattern can scramble your messages beyond recognition.

In the last two issues, we’ve been exploring ciphers that use simple substitution. The first swapped letters of the alphabet around, which the second used ‘pigpens’ to designate each letter then used them to deliver an encrypted code. This issue, we’re going to be looking at a code that doesn’t simply replace letters with other symbols!

This is the case for the Rail Fence Cipher, a very interesting way of delivering messages. We’ll still be sending normal-looking letters as our message, but it’ll be so scrambled up that anyone who doesn’t know the code won’t know what it says. Even better, unlike simple substitution, it’s not just regular letters interchanged with other ones, meaning it’s a little trickier to crack!

So, let’s explore how you make a more complicated code with the Rail Fence Cipher. To start with, think of a message you want to send. For this example, we want to send the message “HELLO WORLD”.

Then, decide on the amount of ‘rails’ you want to use. For this example, and a good starting point in general, we’re going to use three rails. However many rails you choose, draw them out like this:


Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year!

Subscribe Today!

Also In The December 2017 Issue

Building and creating your tools with the Minecraft toolbox helps you survive the game.

Sensors give robots the senses humans have.

30+ ideas for all age holiday gifts, from books to apps to board games to VR and more.

There might be a reason that too-real robot and video game character creeps you out.

This programming language uses colors instead of text and punctuation to add and perform other tasks.

Knowing how passwords are cracked can help you create better passwords.

There are a number of strategies teachers (plus parents and students) can take to learn programming.

This project uses conductive thread to create a glove to activates your phone.

Software programming does neat things with language, in this case, mixing capital letters.

This Scratch game has lots of ways you can customize the game play. No cats were harmed in the making of this article either.

Links from the bottom of all the October 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for October 2017.