Nihilist Cipher
A Polybius square and some arithmetic
- encrypted_txt
The Nihilist cipher is a 19th-century Russian invention that stacks two ideas on top of each other, and the result is the kind of thing puzzle designers adore: simple enough to explain in a footnote, tedious enough that nobody wants to solve it by hand. The Nihilist node in this pack lets you encrypt and decrypt it in the graph, and if you're solving ARGs you will eventually run into a Nihilist-encoded clue.
Here's the mechanism, in three steps. First, you build a Polybius square - a 5×5 grid of the alphabet - seeded by your keyword, and use it to turn each plaintext letter into a two-digit coordinate. Second, you build a second Polybius square from the keyword itself and convert each key letter into coordinates the same way. Third, you add each plaintext coordinate pair to its corresponding key coordinate pair, digit by digit. The result is a string of numbers that's the ciphertext. Decrypting means subtracting the key coordinates back off and looking the coordinates up in the square. There's usually a transposition step bolted on as well, which is where the name's reputation for being fiddly comes from.
The node is a secretpy wrapper, so the input shape is the same as every other classical cipher in the pack:
- text - the message, plain string.
- key - the keyword; it drives the Polybius square and the key coordinates, so it must match exactly between encrypt and decrypt.
- alphabet -
ENGLISHby default; swap in a custom alphabet or a predefinedsecretpyalphabet name for non-English work. - mode - encrypt or decrypt.
- keep_formatting - on by default: letters get encrypted, punctuation and case get restored around them. Off: clean lowercase ciphertext with no spaces, the form you'd actually hand to a solver.
Output is encrypted_txt, a STRING. Nihilist ciphertext reads as numbers (with formatting on, those numbers survive while letters swap), so don't be surprised when the output doesn't look like a cipher - that's the cipher working as intended.
Install the pack via ComfyUI Manager (search "ComfyUI ARG Toolkit"), restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI; the node is under ARG Toolkit/Cryptography/Classical. No model downloads, and the only real install step beyond cloning is the pack's Python dependencies, which Manager handles.
The trap to watch for: Nihilist is a keyword-driven cipher, and it's merciless about mismatched keys - decrypt with a slightly different keyword and you get numbers that never resolve, with no error to tell you. Also note the author's own framing: this is an amateur project whose tests cover the common cases only. If your output looks wrong on a long message, sanity-check the key and alphabet before assuming the node is at fault.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | Hello World! | — |
| alphabet | STRING | ENGLISH | Input your alphabet here. If left blank, uses the alphabet default to the cipher. Uses standard connected format ('abcdef'), but can also accept the alphabets defined in secretpy in alphabets.py. |
| mode | BOOLEAN | true | Toggle between encrypting or decrypting a message. |
| keep_formatting | BOOLEAN | true | Toggle between preserving the format of the message or remove all spaces, punctuations, and convert to lowercase. |
| key | STRING | Accepts any text in the alphabet's language as the key to decrypt/encrypt. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| encrypted_txt | STRING | — |