Porta Cipher
The 16th-century cipher that encrypts and decrypts the same way
- encrypted_txt
Porta is a polyalphabetic cipher from 1563 that most people have never heard of, and it deserves a moment: it was the best of its era, it's reciprocal - encrypting and decrypting are literally the same operation - and it still shows up in puzzle hunts precisely because it's obscure enough to be a real obstacle. The Porta node gives you it inside ComfyUI, and it's one of the pack's most interesting classical ciphers to play with.
How it works: the alphabet is split into 13 pairs of substitution alphabets. Each key letter selects one of those pairs, and the current plaintext letter is replaced by its partner within the selected pair. Because the substitution within each pair is symmetric - A swaps with N, B with O, and so on - running the operation twice gets you back to the original. That's the reciprocal property, and it means the same node and key encrypt and decrypt with no mode switch ever going wrong.
Inputs follow the pack's standard classical-cipher template:
- text - the message, plain string, multiline.
- key - any text in the alphabet's language. Every character of the key picks the substitution alphabet for the corresponding position of the message.
- alphabet -
ENGLISHby default; supply a custom alphabet or asecretpypredefined name if you're working in another language. - mode - encrypt or decrypt. (Thanks to reciprocity, this barely matters - but it's there.)
- keep_formatting - on by default: only letters get transformed, case and punctuation restored around them. Off: lowercase, no spaces, classic ciphertext.
Output is encrypted_txt, a STRING.
A fun property of Porta that makes it a great ARG building block: since encrypting twice restores the message, it's the same mechanism as ROT13 on that front - but unlike ROT13, the key makes it keyed, so two players with different keys read different messages from the same ciphertext. Layered with a transposition cipher, it gets properly nasty, which is probably how a puzzle designer would use it.
Install: ComfyUI Manager → search "ComfyUI ARG Toolkit" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI; it's under ARG Toolkit/Cryptography/Classical. No model downloads - the classical ciphers all run on the pack's secretpy dependency.
One practical note: the key repeats across the message, so a short key over a long message gives you a period the same way Vigenère does - that's how these ciphers get broken, and it's how you'd solve one if you're on the solver side. And keep the author's framing in mind: amateur project, tests cover common cases only. Normal sentences round-trip fine; weird punctuation is where you'd want to double-check your inputs.
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 | — |