The Vigenère Cipher  

  RSS

0

The Vigenère Cipher is a simple cipher from the 16th century.

This cipher does require a key and to understand what's going on, let's look at The Vigenère Square.

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

The Vigenère cipher uses this table in conjunction with a key to encipher a message.

For example, if we take the key 'JAVA' and encrypt the message (or plaintext) 'COMPUTER SCIENCE', we first set them up in a table like this.

       Key: J A V A J A V A J A V A J A V
Plaintext: C O M P U T E R S C I E N C E
Ciphertext:

For our first letter we look back at our table, go along the rows to the letter 'J', as indicated by the first letter in our key, we then go three cells down to the 'C'th position as indicated by the first letter in our plain-text. Where 'C' and 'J' intersect is 'L', so that will be the first letter of our cipher-text.

We do this for the entire length of the plaintext (which makes writing a program handy), and we end up with this:

       Key: J A V A J A V A J A V A J A V
Plaintext: C O M P U T E R S C I E N C E
Ciphertext: L O H P D T Z R B C D E W C Z

There we go! We encrypted, but now... decryption?
Decryption is actually really simple, though you must know the key.

Firstly, you go across to the first letter in the key, then down until you see the first letter of the cipher-text. Like so:

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

Then you look across to which row you are on. In our case, the first letter of our cipher-text points to 'C', which is correct! You then do this for every character in the cipher-text:

       Key: J A V A J A V A J A V A J A V
Ciphertext: L O H P D T Z R B C D E W C Z
Plaintext: C O M P U T E R S C I E N C E

 

 

"Computer science is no more about computers than astronomy is about telescopes."
~ Edsger W. Dijkstra

 
0

Nice use of the modular arithmatic here, devised by Gauss. If you give a number to each letter of the alphabet, then the number you show up with is a=b (mod 26) where a and b are less than or equal to 26. To make the Vigenère square at least

"Either this wallpaper goes, or I go"- Oscar Wilde's last words

 
Share:
  
Working

Please Login or Register