Vigenere

The Vigenere cypher is a transposition cypher that uses all the permutations of the alphabet (in-order) and a supplementary key to encrypt with.

The table of permutations of the alphabet is:

     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

In order to encrypt a plaintext, for example it is a good day with the key was, write the key repeatedly as many times as necessary above the plaintext:

Key:       w a  s w  a  s w a s  w a s
Plaintext: i t  i s  a  g o o d  d a y

and then look-up the letter of the key in the row alphabet, the plain-text letter in the column alphabet and write down the intersection:

Key:        w a  s w  a  s w a s  w a s
Plaintext:  i t  i s  a  g o o d  d a y
Cyphertext: e t  a o  a  y k o v  z a q

the cypher-text is thus: et ao a ykov zaq.

Decryption is similarly performed by writing the key repeatedly above the cypher-text:

Key:        w a  s w  a  s w a s  w a s
Cyphertext: e t  a o  a  y k o v  z a q

We then take (in-sequence) a letter of the key and go to the row corresponding to that letter, slide all the way across the row to find the cypher-text letter and then go up to find the column letter in order to reveal the plain-text letter:

Key:        w a  s w  a  s w a s  w a s
Cyphertext: e t  a o  a  y k o v  z a q
Plaintext:  i t  i s  a  g o o d  d a y

which results in the plain-text: it is a good day.

Implementations