# Straddling checkerboard

A straddling checkerboard is a device for converting an alphanumeric plaintext into digits whilst simultaneously achieving fractionation (a simple form of information diffusion) and data compression relative to other schemes using digits. It also is known as a monôme-binôme cipher.

## History

In 1555, Pope Paul IV created the office of Cipher Secretary to the Pontiff. In the late 1580s, this position was held by members of the Argenti family, most notably Giovanni Batista and his nephew, Matteo. Matteo was the first to intentionally obscure borders between one-digit and two-digit codes, designing the first variable length cipher, although this was still a substitution cipher:
| a | b | c | d | e | f | g | h | i | l | m | n | o | p | q | r | s | t | u | z | et (&) |
| 6 | 84 | 34 | 80 | 2 | 43 | 83 | 33 | 7 | 03 | 40 | 00 | 9 | 48 | 44 | 30 | 04 | 08 | 1 | 88 | 38 |
With that cipher, La vigilanza di papa Clemente fu grande in ogni genere de negotii was enciphered as 550365178370360088658074864865534032402000824315833060080257009830075583200230258020028390875.
The following table rearranges the same key so that the column number corresponds to the second digit and while the row correspond to the first digit or lack thereof:
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| | null | u | e | null | null | null | a | i | null | o |
| 0 | n | null | null | l | s | null | null | null | t | null |
| 3 | r | null | null | h | c | null | null | null | & | null |
| 4 | m | null | null | f | q | null | null | null | p | null |
| 8 | d | null | null | g | b | null | null | null | z | null |
Comparing this table with a lower one, it is evident that it is not the modern straddling checkerboard, and letters encoded with one digit are not the most frequent letters of Latin (T is much more frequent than O), but the idea exploited in the latter ciphers is present.
In its modern form described below the cipher's first documented use was in 1937 by Swedish communist Per Meurling [se] during the Spanish Civil War. It was later used as the basis for the message-to-digits step in the VIC cipher.

## Mechanics
### Setup

A straddling checkerboard is set up something like this:
| | 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 header row is populated with the ten digits, 0-9. They can be presented in order, as in the above table, or scrambled (based on a secret key value) for additional security. The second row is typically set up with eight high-frequency letters (mnemonics for the English language include; 'ESTONIA-R', 'A SIN TO ER(R)', 'AT ONE SIR', 'AERO TINS'), leaving two blank spots; this row has no row coordinate in the first column. The remaining two rows are labeled with one of the two digits that were not assigned a letter in the second row, and then filled out with the rest of the alphabet, plus the two symbols '.' and '/'.
* The period '.' is used as a full stop or decimal separator,
* The slash '/' is used as a numeric escape character (indicating that a numeral follows).
Similar to the ordering of the digits in the header row, the alphabet characters can be presented in order (as it is here), or scrambled based on a secret keyword/phrase.

### Enciphering

Letter-Encipherment: To encipher a letter in the second row is simply replaced by the number labeling its column. Characters in the third and fourth rows are replaced by a two-digit number representing their row and column numbers (with the row coordinate written first, i.e. B=20)
Digit-Encipherment: To encipher a digit, there are a few possible methods (which must be known/agreed beforehand):
* Single Digit Escape: Encode the numerical escape character (i.e. the slash '/') as per any letter, then write the required digit 'in-clear'. This means a digit is encrypted by 3 ciphertext characters; 2 for the escape character, 1 for the digit itself. In this scheme, each digit requires an escape character encoded before it.
* Double-Digit Scheme: If the escape character is encoded by two different digits (e.g. '26' in the example above), then multiple digits can be encoded by writing each out twice. To 'escape' back to text the escape character is used. In this way a stream of digits can be encoded with only one escape character. This method cannot be used if the escape character is itself encoded by a double digit combination.
* Triple-Digit Scheme: As per the double-digit scheme above, but triple digits are used. This was the mechanism used in the VIC cipher.'

#### Example

The table below shows the conversion of string "ATTACK AT DAWN" into numbers using the straddling checkerboard setup above.
| Plaintext | A | T | T | A | C | K | A | T | D | A | W | N |
| Numbers | 3 | 1 | 1 | 3 | 21 | 27 | 3 | 1 | 22 | 3 | 65 | 5 |
The resulting message, 3113212731223655 has to be secured by other means if the straddling checkerboard table is not scrambled. By passing digits through an additional transposition or substitution cipher stage can be used to secure message -- to whatever extent transposition or substitution can be considered secure.
For example, securing the message above using as a secret key digits "0452" -- digits of the secret key are repeated to get at least as many digits as there are digits in the message -- and adding modulo 10 for transposition produces:
| Message digits | 3 | 1 | 1 | 3 | 2 | 1 | 2 | 7 | 3 | 1 | 2 | 2 | 3 | 6 | 5 | 5 |
| Key digits | 0 | 4 | 5 | 2 | 0 | 4 | 5 | 2 | 0 | 4 | 5 | 2 | 0 | 4 | 5 | 2 |
| Cipher digits | 3 | 5 | 6 | 5 | 2 | 5 | 7 | 9 | 3 | 5 | 7 | 4 | 3 | 0 | 0 | 7 |
The message can also be ciphered with a substitution cipher using the same straddling checkerboard to convert the digits back to letters again:
| Message numbers | 3 | 5 | 65 | 25 | 7 | 9 | 3 | 5 | 7 | 4 | 3 | 0 | 0 | 7 |
| Ciphertext | A | N | W | H | R | S | A | N | R | O | A | E | E | R |
Deciphering is simply the reverse of these processes. Although the size of groups can vary, deciphering is unambiguous because whenever the next element to be deciphered starts with a 2 or a 6, it is a pair; otherwise, it is a singleton. If the letter decoded is the numerical escape character '/' then the next 1+ digits (depending on scheme) are to be interpreted as a digit.

## Cryptographic properties

Compression: The more common characters are encoded by only one character, instead of two; this reduces the ciphertext size and potentially the cipher's proneness to a frequency attack.
Fractionation: Unlike in the Polybius Square (where every character is represented by a pair of digits), a straddling checkerboard will not encrypt each character with the same number of ciphertext digits. This makes it harder for a cryptanalysts to determine the boundaries between plaintext characters. This may be combined with a transposition (as it is in the VIC cipher) in order to locate the ciphertext letters of the same plaintext character at unknown locations in the ciphertext.