# How to solve a Vigenère cipher?

This is not a puzzle, this is an actual question

Recently I tried to solve a puzzle on this site, which I was certain used a Vigenere cipher. I'd never heard of it before the puzzle, so I went straight to the Guide, and later to Wikipedia.

I understand a Vigenere cipher has 3 parts: the plain text, the key and the encrypted text. It is my understanding you would need at least two of these parts; however, the guide seems to suggest you can use the index of coincidence to find the key from the encrypted text, although I may be wrong.

I seem to do okay with Wikipedia's example:

Plaintext: ATTACKATDAWN
Key: LEMON
Ciphertext: LXFOPVEFRNHR

Here Wikipedia explains that the key would simply be repeated to make as many characters as the encrypted text / plain text, so it comes out as LEMONLEMONLE.

From there and using their helpful image (attached as it appears to be in public domain) (click for larger version) I understand that looking at the L row from the first column (the first letter in the key), and finding the L (first letter of encrypted) in that row, I get A. Using the same logic for the rest:

Row L pos L = A
Row E pos X = T
Row M pos F = T
Row O pos O = A
Row N pos P = C
Row L pos V = K
Row E pos E = A
Row M pos F = T


and so forth; however, I tried to apply this logic to a puzzle, who's encypted text was cicessrt and key was cantwait, and all I got was gibberish:

Row c pos c = a
Row i pos a = s
Row c pos n = l
Row e pos t = p
Row s pos w = e
Row s pos a = i
Row r pos i = r
Row t pos t = a


The answer is actually meant to be

Star wars

It feels like I tried and double checked everything, including swapping the key + encrypted text (which gives more gibberish) and attempting to start with the plain text and use the key to get the encrypted text (more gibberish), and I'm at a loss. Given the encrypted text and the key, how is it possible to solve the Vigenere cipher? What did I do wrong?

• 'a puzzle' - This puzzle: puzzling.stackexchange.com/questions/55816/…. Please include attribution. – boboquack Oct 18 '17 at 7:41
• My apologies: I thought to do so, but didn't want to draw unnecessary attention, plus I wasn't certain if it was truly relevant. – Tas Oct 18 '17 at 7:43
• Thank you for asking this. I was on the same track as you and I couldn't seem to make the Vigenere cipher work for me either. – BlackThorn Oct 18 '17 at 15:25
• As the person that created that puzzle, I would be happy to make a walkthrough of my thought process on its creation, if you want, too. – phroureo Oct 18 '17 at 16:09
• @phroureo: Yes, why not? But you could also write a wrap-up post as answer on your own question. – M Oehm Oct 18 '17 at 17:04

[I'll ditch the spoiler markup here, because this isn't a puzzle. This post does contain spoilers for the mentioned puzzle, though.]

The mentioned puzzle uses a keyed Vigenère cipher. It works just like a Vigenère cipher, but uses the transposed alphabet

    S E R T I C U A K D F M N G H W X P O L B Y V J Q Z


The Polybius square for that alphabet is:

    S E R T I C U A K D F M N G H W X P O L B Y V J Q Z

S   S E R T I C U A K D F M N G H W X P O L B Y V J Q Z
E   E R T I C U A K D F M N G H W X P O L B Y V J Q Z S
R   R T I C U A K D F M N G H W X P O L B Y V J Q Z S E
T   T I C U A K D F M N G H W X P O L B Y V J Q Z S E R
I   I C U A K D F M N G H W X P O L B Y V J Q Z S E R T
C   C U A K D F M N G H W X P O L B Y V J Q Z S E R T I
U   U A K D F M N G H W X P O L B Y V J Q Z S E R T I C
A   A K D F M N G H W X P O L B Y V J Q Z S E R T I C U
K   K D F M N G H W X P O L B Y V J Q Z S E R T I C U A
D   D F M N G H W X P O L B Y V J Q Z S E R T I C U A K
F   F M N G H W X P O L B Y V J Q Z S E R T I C U A K D
M   M N G H W X P O L B Y V J Q Z S E R T I C U A K D F
N   N G H W X P O L B Y V J Q Z S E R T I C U A K D F M
G   G H W X P O L B Y V J Q Z S E R T I C U A K D F M N
H   H W X P O L B Y V J Q Z S E R T I C U A K D F M N G
W   W X P O L B Y V J Q Z S E R T I C U A K D F M N G H
X   X P O L B Y V J Q Z S E R T I C U A K D F M N G H W
P   P O L B Y V J Q Z S E R T I C U A K D F M N G H W X
O   O L B Y V J Q Z S E R T I C U A K D F M N G H W X P
L   L B Y V J Q Z S E R T I C U A K D F M N G H W X P O
B   B Y V J Q Z S E R T I C U A K D F M N G H W X P O L
Y   Y V J Q Z S E R T I C U A K D F M N G H W X P O L B
V   V J Q Z S E R T I C U A K D F M N G H W X P O L B Y
J   J Q Z S E R T I C U A K D F M N G H W X P O L B Y V
Q   Q Z S E R T I C U A K D F M N G H W X P O L B Y V J
Z   Z S E R T I C U A K D F M N G H W X P O L B Y V J Q


In the puzzle, you have the Vigenère key

CANTWAIT


and the encoded text

cicessrt.


Look up the c row until you find C, which is in the s column. The A in the i row is in column t. The N in the c row is in the A column. And so on.

This online solver allows you to key your alphabet. In this case, the whole transposed alphabet is given, but often the transposed alphabet is generated with a keyword, where the unique letters of the keyword are used first and the rest is filled up with unused letters, hence the name "keyed".

The alphabet for the key phrase "The quick brown fox" is:

   T H E Q U I C K B R O W N F X A D G J L M P S V Y Z

• Not to be a Tommy Technical, but the alphabet square above is a Tabula Recta. Not a Polybius Square. (I'm sorry, sometimes I can't help it.) – Neo1009 Oct 4 at 23:19