Keyword Cipher
One word scrambles the whole alphabet
- encrypted_txt
The Keyword node is a monoalphabetic substitution cipher where the alphabet gets scrambled by a single word. It's the kind of cipher that shows up constantly in ARGs and puzzle hunts because it's easy to encode by hand and just hard enough to make someone reach for a tool. This node is that tool, sitting inside your ComfyUI graph.
How it works: you pick a keyword, say HELLOWORLD. You write it out, dropping duplicate letters, then fill in the rest of the alphabet behind it. That gives you a brand-new substitution alphabet:
abcdefghijklmnopqrstuvwxyz (plain)
helowrdabcfgijkmnpqstuvxyz (cipher)
Every letter in your message is swapped for its partner in the second row. Decrypting is the same table read backwards. This is powered by secretpy under the hood, the same library the pack uses for all its classical ciphers, so the behavior is consistent across every cipher node here.
The inputs are friendly for a text puzzle:
- text - your message, plain string, no bytes conversion needed.
- key - the keyword. Keep it in the alphabet's language (English by default).
- alphabet - defaults to
ENGLISH. Leave it, or type your own alphabet in connected format (abcdef…), or use one of the predefined names insecretpy's alphabets if you're working with non-English text. - mode - toggle between encrypt and decrypt.
- keep_formatting - this one's worth understanding. On (the default), the node only encrypts letters and restores uppercase and punctuation, so
Hello, World!comes back looking like a sentence. Off, it strips everything down to lowercase letters with no spaces - the classic "ciphertext" form you'd actually hand to someone in a puzzle.
Output is a single STRING, encrypted_txt, ready to feed into another cipher node (stacking ciphers is a very ARG thing to do) or a text display/save node.
Install the pack through ComfyUI Manager (search "ComfyUI ARG Toolkit") and restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI and it's under ARG Toolkit/Cryptography/Classical. No models, no downloads - the pack's only real install weight is its Python dependencies (secretpy, cryptography, reedsolo, plus the steganography libs Manager pulls in), and those install automatically.
Two honest gotchas. First, the author calls the test coverage "most common use cases only" - a keyword that's all in one case is fine, but don't expect the node to survive every weird edge case. Second, when keep_formatting is off, the output is lowercase with no spaces, which is correct ciphertext but easy to misread as a bug the first time you see it.
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 | — |