# Vigenere Cipher With Rotating Cleartext

9,449

7

6

Published

## Introduction: Vigenere Cipher With Rotating Cleartext

The Vigenere cipher was publicized by Lewis Caroll, who's best known for writing the Alice books and poetry. Essentially, the cipher is a complex shift code, based on a key word.

For a full explanation of the code, visit http://en.wikipedia.org/wiki/Vigenère_cipher

In this instructable, I'll lay out a method by which the cleartext (the initial message, before encryption) can be disguised to help prevent decryption using either of the methods, since even decrypted it would read as gobbledygook.

The concept of rotating cleartext I got from Dan Brown's book Digital Fortress.

## Step 1: Select Cleartext

For the method I'll be using here, the cleartext should be a square number of letters. For example, one flew over the cuckoo's nest.

However, you could choose any cleartext you want, you can usually play with it to get a square number of letters.

## Step 2: Rotating the Cleartext

To prevent the cipher from being too easy to crack, you need to change the cleartext in a reversible manner. My method, rotating it, involves writing the cleartext in columns and then reading it in a spiral. Once done, you can add a random letter at every prime numbered space, or some other pattern that's easy to remember and hard to crack.

In this example I started from the middle of the left side, and reversed direction for the second loop of the spiral.

## Step 3: Choose Keyword

The most important thing to remember is that the keyword is the security of your message. if you choose one that's too short, it can be cracked extremely easily. However, if you choose one that's too long relative to the cleartext, it can get dicey. Usually a keyword of 6-10 letters is decent. For the sake of the demonstration I'll use abcdefghi as the keyword.

## Step 4: Encrypt

Write the keyword above the cleartext, repeating until you reach the end of the text. using the vigenere chart, make a third line with the intersections between each two letters that are matched vertically. Once you finish, you have the coded message.

## Step 5: Share

If you haven't shared the keyword in advance, you can tack it on the end of the coded message, but for that you have to hide it. you could do the same thing you did with the cleartext in step 2. Give to a friend who knows the protocol and you're finished.

## Recommendations

• ### Crate Lamp/Shelf! Made From Reused Material!!

4,693 Enrolled

## 6 Discussions

Jules Verne used something like this in "800 Leagues on the Amazon." He used a numeric key to shift everything. So using the key 1234567890 and the clear text "Once in a galaxy far far away," you'd get: ppfinthojlbzbjfxmiaaxcb. 0 can shift either 10 characters or 0. I use 0. The key repeats ad infinitum. I'd never thought of using random characters at prime positions.

The Vigenere cypher is a similar idea, except the shift can be up to 26 characters instead of 9 or 10.

However, if you choose one that's too long relative to the cleartext, it can get dicey.

Is it?  From what I remember of my crypto course, for a Vigenere-style cipher you want the key to be as long as possible, preferably the same length as the cleartext with no repeating patterns.  The "secret weapon" against Vigenere ciphers (or more broadly, substitution ciphers) is frequency analysis, and if the key is only a few letters long you can quite easily do multiple periodic frequency analyses (every 6th letter with varying offsets from the beginning of the ciphertext) and deduce the key providing the message is long enough.

Ideally, I think, you want an aperiodic key that never repeats, at which point I think you have a one-time pad which is a slightly stronger class of encryption than Vigenere.  Can you tell me why an overly long key is a bad thing?
3 replies

We could start with the obvious problem, remembering it. However, there's a second problem, which arises from the method of sharing in the last stage, which is that the longer the key-word is, the more likely someone is to notice you tacked it on the end. I also address the issue of repeating patterns using the other two methods of encryption before reaching the keyword.

Ah, very true- long keys present a problem if they aren't pre-shared. I noticed your suggestion to add random letters at irregular intervals but it took me a moment to twig that that will foil periodic frequency analysis. It's quite a nice solution, actually- mine to the same problem was to mess with the keytext using prime numbers, but I think I prefer yours.

Messing with the keytext using prime numbers? What kind of messing?