# VIC cipher

- Description
- Algorithm
- Implementation

The VIC cipher uses a table which allows changing letters of plaintext into numbers. It is called a straddling checkerboard.

It differs from tables used in other substitution ciphers because it produces shorter sequences of numbers (it is much more comfortable for sending to the second party).

The straddling checkerboard can be created in the following form:

0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |

E | T | A | O | N | R | I | S | |||

2 | B | C | D | F | G | H | J | K | L | M |

6 | P | Q | / | U | V | W | X | Y | Z | . |

The highest row is populated with the ten digits from 0 to 9. The second row is typically filled with popular letters in any order. In English a mnemonic ESTONIA-R can be used to remember the most frequent letters. Free cells should be left under two digits and in the leftmost column.

Each of both lower rows receives one of the two remaining digits, which isn't used in the second row. Then, the two rows should be filled with letters in alphabetical order. Because of two empty remaining cells, two additional special characters may be entered into the table. They can be used for special purposes or shortcuts agreed previously between the two parties.

During encryption using VIC one should replace letters of the message by numbers created based on numbers of rows and columns. The most popular letters should be replaced by only one digit of the column (that results in producing shorter ciphertext).

For example, one can encrypt the name of the famous Scottish queen using the table presented above:

M | A | R | Y | Q | U | E | E | N | O | F | S | C | O | T | S |

29 | 3 | 7 | 67 | 61 | 63 | 0 | 0 | 5 | 4 | 23 | 9 | 21 | 4 | 1 | 9 |

It should be noticed, that a lot of numbers in the received sequence have only one digit.

The next step is to add some specified numbers to the all digits of the created sequence. One should add one by one all digits of the changing message to all digits of the secret sequence. After the last letter of the secret sequence, algorithm goes back to the first digit of the sequence and continues its work. The addition is done modulo 10, so if the result is bigger than 10 then the tens digit should be discarded.

Continuing the example, one could add the received numbers to the secret sequence of four digits, the year of Mary's birth (1542):

2 | 9 | 3 | 7 | 6 | 7 | 6 | 1 | 6 | 3 | 0 | 0 | 5 | 4 | 2 | 3 | 9 | 2 | 1 | 4 | 1 | 9 | |

+ | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 5 | 4 | 2 | 1 | 5 |

= | 3 | 4 | 7 | 9 | 7 | 2 | 0 | 3 | 7 | 8 | 4 | 2 | 6 | 9 | 6 | 5 | 0 | 7 | 5 | 6 | 2 | 4 |

The received digits can be used as a ciphertext and send to the second party. Sometimes, it is a good idea to change digits back into letters, using the same table as during encryption. Changing numbers into letters is straightforward and intuitive. After finding one of the two digits which are assigned to the two lower rows, one should use a proper two-digit number.

The sequence of digits received previously can be changed into a sequence of letters as below:

3 | 4 | 7 | 9 | 7 | 20 | 3 | 7 | 8 | 4 | 26 | 9 | 65 | 0 | 7 | 5 | 62 | 4 |

A | O | R | S | R | B | A | R | I | O | J | S | W | E | R | N | / | O |

Decrypting can be performed using the same straddling checkerboard, the same secret number and the steps performed in reverse order. The secret number's digits should be subtracted from ciphertext's digits. If any of the results are smaller than 0, then one should add 10 to the ciphertext's digits.

## Security of VIC

The VIC cipher is well designed and provides quite good security. It makes ciphertext analyzing very time-consuming by breaking the original frequency distribution.

There are many modifications of the VIC cipher. Changes can be introduced in the straddling checkerboard by changing the order of letters. Some cells may be left empty, what makes cryptanalysis more difficult.

The received ciphertext's characters can be modify at the end of encryption using one of the transposition ciphers' algorithms.