The Vigenere cipher is a simple example of a polyalphabetic
cipher. In its original form, it is based on the Vigenere
tableau:
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
To encode using this cipher, first choose a keyword, such as "LURID", and write it above the plain text repeatedly:
LURI DL URIDLURI DL URI DLU RID LURI
Plain Text: MEET AT MIDNIGHT BY THE OLD OAK TREE
The cipher letter is the letter in the tableau determined by the keyword column and the plaintext row. Thus the first "M" of the message is encrypted as "X", the first "E" as "Y", and so on.
To decrypt the Vigenere cipher, you run this process in reverse. Alternatively, you can reverse the keyword by replacing every letter by its negative (mod 26). For example, LURID contains letters numbered 11,20,17,8, and 3 (with A=0). The negatives mod 26 are 26-11=15, 26-20=6, 26-17=9,26-8=18, and 26-3=23, which corresponds to the word PGJSX. So encrypting with PGJSX decrypts LURID.
Breaking the Vigenere cipher is accomplished using the index of coincidence.
We present here some perl scripts for playing with
the Vigenere cipher. Tools for Vigenere ciphers
A script which encrypts using the Vigenere
cipher; specify the keyword as an argument on the command line.
A script which decrypts using the Vigenere
cipher; specify the keyword as an argument on the command line.