Vigenère Cipher


First described by Giovan Battista Bellaso in 1553, the cipher is easy to understand and implement, but it resisted all attempts to break it until 1863, three centuries later. This earned it the description le chiffre indéchiffrable (French for 'the indecipherable cipher'). Many people have tried to implement encryption schemes that are essentially Vigenère ciphers. In 1863, Friedrich Kasiski was the first to publish a general method of deciphering Vigenère ciphers. In the 19th century the scheme was misattributed to Blaise de Vigenère (1523–1596), and so acquired its present name. (thx wiki). Hack it here

The Vigenère cipher is "related" to the Caesar cipher, but because it uses a number of substitutions (2 or more), it is technically a "POLYALPHABETIC Cipher.

The "key" is a phrase that both the sender and receiver knows.

The "Tableau" (2 character lookup table) that a Vigenère cipher uses can be envisaged as follows:
Vignere Tableau


Vigenère Encryption (1 key)example
ClearText: W E   A T T A C K   A T   D A W N
Key: A L E R T A L E R T A L E R T A L
CipherText W P   R M Y L G B   A E   U T W Y

As keylength goes up, the number of possible substitutions needed to be brute-force checked skyrockets:
Vignere Tableau
stolen from Tutorials Point


Let's try it out:



#Thanks Greg Egan for the Pseud starter
	SET cryptText=''
	SET keyIndex = 0
	INPUT mode
	INPUT upcase(message)
	INPUT upcase(key)
	SET keyLength = length of key

	FOR each char in message:
		IF char not in alphabet THEN
			CALCULATE cryptText += char
			SET letterPos = position of char in alphabet
			SET keyChar = key[keyIndex]
			SET keyPos = position of keyChar in alphabet

			IF mode = 'encrypt' THEN
				CALCULATE newIndex = (letterPos + keyPos) mod 26
				CALCULATE newIndex = (letterPos - keyPos) mod 26

			CALCULATE keyIndex = (keyIndex + 1) mod keyLength		
			SET cryptText += alphabet[newIndex]

	PRINT cryptText


It seems both the Gronsfeld and Beaufort ciphers are variations of Vigenère - read a paper I stole from about these variations