The Nihilist Substitution is a poly-alphabetic cipher which means it uses multiple substitution alphabets and similar to the Vigenère Cipher.
The key consists of a 5×5 polybius square which has all the letters in the alphabet however I/J are treated the same and a second key.
1 | 2 | 3 | 4 | 5 | |
1 | A | B | C | D | E |
2 | F | G | H | I/J | K |
3 | L | M | N | O | P |
4 | Q | R | S | T | U |
5 | V | W | X | Y | Z |
The second key can be of any length, keep in mind that the longer the key the more secure it theoretically is, however the key should be memorable so a person could remember and use it. Examples:
MAGIC, KEY, DEFEND, POLYALPHABETIC etc.
Encryption
Consider the polybius square created using the keyword CIPHER
1 | 2 | 3 | 4 | 5 | |
1 | C | I/J | P | H | E |
2 | R | A | B | D | F |
3 | G | K | L | M | N |
4 | O | Q | S | T | U |
5 | V | W | X | Y | Z |
and a second key of PAGE which defines the period as 4.
The second key is replaced with its position the polybius square (row then column), the numbers effectively become the key. Then each plaintext letter is written in rows of the period length and it too also replaced with its position the polybius square (row then column). The cipher text is then the sum of the key and the cipher text numbers. If the number is greater than 99 (3 digit number) subtract 100. 105 becomes 05, 100 becomes 00.
P A G E P A G E P A G E 13 22 31 15 13 22 31 15 13 22 31 15 ----------- ----------- ----------- W H E N S T R I E A T T 52 14 15 35 43 44 21 12 15 22 44 44 65 36 46 50 56 66 52 27 28 44 75 59 ----------- ----------- ----------- T H E C K E S T A C K 44 14 15 11 32 15 43 44 22 11 32 57 36 46 26 45 37 74 59 35 33 63 ----------- ----------- L O C K W E L V 33 41 11 32 52 15 33 51 46 63 42 47 65 37 64 66
WHENTHECLOCKSTRIKESTWELVEATTACK using these keys encrypts to 65364650573646264663424756665227453774596537646628447559353363.
Decryption
To decrypt simply split the number text into blocks of 2 and write each block in rows of the period length then subtract the key numbers. If the result is less than 0 add 100.
There are however some serious flaws that significantly decrease the security of this cipher, these flaws can be used to break the Nihilist Substitution Cipher.
Does a Nihilist Ciphertext always have an even number of digits?
Yes it should. Although as with any cipher you could add a twist to alter it.
First thoughts I think you could modify this algorithm so that for numbers that sum to >= 100, instead of removing the 1 (subtracting 100) you could leave the 1 in. This would still make a valid cipher algorithm since you could still identify which digits go in what column. If the digits you are looking at are 10 or 11 then it must be one of these 3 digit numbers, so instead of taking 2 digits take 3. This would make it possible for the cipher text to have an odd number of digits.
E.g Folliwing ciphertext can be split up as so,
56107853211034
56 107853211034 <- 56 is not 11 or 10, so only take 2 digits 56 107 853211034 <- is 10 so take an extra digit 56 107 85 3211034 <- 85 is not 11 or 10, so only take 2 digits 56 107 85 32 11034 <- 32 is not 11 or 10, so only take 2 digits 56 107 85 32 110 34 <- is 11 so take an extra digit Each block of digits can then be placed it their own column.
Thank you Alex! That helps a lot. Especially for the step-by-step example.
I’m being driven mad by a numeric cipher that has no delimiters, and additionally it has an uneven number of digits. That was an excellent idea of yours to adjust for the modulo encryption, thank you!
Unfortunately it’s proving resistant! Adjusting for numbers that sum >=100 wouldn’t accomodate for this troublesome string of “49020149”, if I understand your advice correctly.
I’ve been researching VIC and Nihilist ciphers (which is how I found your wonderful resource).
Do you have any suggestions or other avenues I should be exploring? I’ve been going through every classic cipher description I can find to see if I can recognise it by its distinguishing features. It’s a patristocrat numeric cipher using the dedimal set 9-0, with a total cipher text of uneven length. What ciphers could possibly produce such a result?
Thank you, Jim
Which cipher should I use to decode the following code?
2511420.753426.7031976
2511420.1506852.0.2511420.1506852.2511420.2511420.1506852
1506852.2511420.7031976.753426.7031976.0