The Nihilist cipher was used by Russian revolutionary nihilists in the 1880s for secret communications. It combines a keyed Polybius square — which converts letters to numbers — with an additive repeating keyword, producing a numerical ciphertext. It was one of the first hand ciphers to layer two separate operations (substitution then addition), an idea that later evolved into far stronger systems.
How it works
Step 1: Build the keyed Polybius square
Write out the unique letters of a square keyword into a 5×5 grid row by row, then fill the remaining alphabet in order (merging I and J into a single cell since 26 letters do not divide evenly into 25 cells). The rows and columns are numbered 1–5. Each letter’s coordinates become its two-digit code:
Using keyword ZEBRAS:
1 2 3 4 5
1 Z E B R A
2 S C D F G
3 H I K L M
4 N O P Q T
5 U V W X Y
The letter A = 15, B = 13, R = 14, and so on.
Step 2: Convert the message
Write each plaintext letter as its Polybius number. Spaces and punctuation are typically dropped.
Step 3: Add the keyword
Convert the additive keyword letters to their Polybius numbers as well, then repeat them in a cycle across the message. Add each keyword number to the corresponding message number using ordinary carrying arithmetic:
C = P + K
Step 4: Decipher
Subtract the keyword numbers from the ciphertext, then look each result back up in the Polybius square.
Worked example
Square keyword: ZEBRAS (as above). Additive keyword: RUSSIA.
Encoding DYNAMITE:
| Letter | P (Polybius) | K (RUSSIA) | C = P + K |
|---|---|---|---|
| D | 23 | R=14 | 37 |
| Y | 55 | U=51 | 106 |
| N | 41 | S=21 | 62 |
| A | 15 | S=21 | 36 |
| M | 35 | I=32 | 67 |
| I | 32 | A=15 | 47 |
| T | 45 | R=14 | 59 |
| E | 12 | U=51 | 63 |
Ciphertext: 37 106 62 36 67 47 59 63
Note that Y + U carries into the hundreds (55 + 51 = 106), which is why the numbers are written space-separated rather than concatenated.
Security and cryptanalysis
The Nihilist cipher is not secure by modern or even early 20th-century standards. Its weaknesses mirror those of the Vigenère cipher:
- The additive keyword repeats, creating periodic structure that a cryptanalyst can exploit with the Kasiski test or index of coincidence methods.
- Once the keyword period is found, the cipher reduces to multiple independent Caesar-like shifts on the Polybius numbers — solvable with frequency analysis.
- A short keyword (especially shorter than the message) makes attacks straightforward; longer keywords delay analysis but do not prevent it.
The cipher was adequate for 1880s hand-transmitted secret communications where opponent cryptanalysis capacity was limited, but modern analysis breaks it quickly given sufficient ciphertext.
The VIC cipher, developed by Soviet intelligence decades later, addressed these weaknesses by replacing the simple Polybius square with a straddling checkerboard (which produces variable-length codes) and adding a columnar transposition stage, making frequency analysis dramatically harder.