© Francisco Ruiz, 2016
This is a cipher based on Baise de Vigenère's classic autokey cipher, adding a substitution. The result is something quite similar to Blaise de Vigenère's authentic autokey cipher, hence the name. Operation is not identical for encryption and decryption, but almost so. In this implementation, the user can select two different substitution keys, plus a separate seed.
The first step is to generate a scrambled alphabet for each substitution key. The process is simple: 1, take the key and write down new letters in the order they appear; if a letter in the text key has already been written, write instead the first letter before it in the alphabet that is still available (wrap around to the end if needed); 2, then write the rest of the alphabet in reverse order. Place alphabet 1 on the top and bottom of the Tabula Recta, alphabet 2 on the left and right sides.
After the plaintext or ciphertext and the seed are processed —spaces and punctuation are stripped, and all letters are converted to capitals; accented letters are replaced by their non-accented versions; numbers in plaintext are converted to letters as in 0=A,1=B,...9=J, but are not converted back— we perform operations using the Tabula Recta on groups of two letters, this way to encrypt: find the first letter at the top and go down until the second letter is found, then left or right to read off the result. When decrypting, we will start on the left rather than the top, and read the result at the top or bottom. Now we discuss how to choose those letters for encryption and decryption. We start with the processed plaintext (ciphertext when decrypting) written out as a row of letters. Since the first phase has less security, you may want to prepend a number of gibberish letters equal to the length of the seed, the better to mask the seed against cryptanalysis.
Encryption, starting from the plaintext:
Decryption starting from the ciphertext is nearly identical to encryption, except that operations on the Tabula Recta start on the sides rather than at the top, and in step 3 the second letter of each operation is taken from the bottom row:
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 | A 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 | B 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 | C 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 | D 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 | E 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 | F 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 | G 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 | H 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 | I 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 | J 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 | K 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 | L 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 | M 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 | N 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 | O 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 | P 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 | Q 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 | R 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 | S 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 | T 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 | U 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 | V 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 | W 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 | X 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 | Y 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 | 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 Z
We begin by making scrambled alphabets out of the keys, which are then placed at the top, bottom, and sides of the Tabula Recta. This is why we input the keys before the plaintext. The boxes are blue to indicate that they can be written on. Do this to make a scrambled alphabet: take each key and write the different letters of the alphabet in the order they appear in the key, if a letter has been used already, write instead the first letter in the normal alphabet not yet chosen; if there are letters that did not appear in the key, write them now in reverse alphabetical order.
It is OK to use keys that have been used before, even for a message of identical length as a previous message. In this program, if you leave the key 2 box empty, key 1 will be used also as key 2.
If you want to use for the seed phase a key different from key 1, write it in this box, otherwise key 1 will be used:
Since the processes for encryption and decryption are slightly different, we need to tell the program what we want to do:
Encrypt Decrypt
Here we tell the program whether or not to prepend some gibberish to the plaintext in order to mask the seed:
No nulls Add nulls
In order to obtain the ciphertext we generate the table below, following the instructions at the top of this page. The bottom row is the output.
Information about output randomness will appear here
The ciphertext (plaintext when decrypting) is the first box below. The lower box contains the same, but split into codegroups of five characters each. Complete the last one with random letters if you need to; they will decrypt to gibberish.