Nodes/ComfyUI ARG Toolkit/Autokey Cipher
ComfyUI Node

Autokey Cipher

The Cipher That Feeds on Its Own Plaintext

By AzelusLightvale·Created 12 months ago·Updated 5 days ago· 1
Autokey Cipher
    • encrypted_txt
    textHello World!
    alphabetENGLISH
    modetrue
    keep_formattingtrue
    key

    Autokey is the Vigenère cipher's smarter, less cooperative cousin, and it's a genuinely good puzzle cipher precisely because it's a pain to crack by hand. Regular Vigenère repeats your keyword forever, which is what makes it vulnerable to Kasiski-style analysis. Autokey's trick: after the keyword runs out, it keeps encrypting using the plaintext itself as the continuation of the key. So the first few letters are Vigenère-with-a-keyword, and the rest are a key stream the solver doesn't know - because it's the very message they're trying to read. That's the "autokey" in the name, and it's why the classic attacks on Vigenère bounce right off it.

    In the ARG Toolkit it's a standard classical cipher node: same text, alphabet, mode, and keep_formatting inputs as the rest of the family, plus a key string - the tooltip asks for any text in the alphabet's language. The key seeds the cipher; the plaintext takes over from there. Output is the usual single encrypted_txt STRING.

    The inputs that matter

    • key - the seed. Short is fine; the longer the seed, the longer the initial Vigenère-style stretch before plaintext takes over. An empty key still works (pure plaintext-feedback mode) but it's barely a cipher at that point.
    • mode - encrypt/decrypt toggle (on = encrypt). Decryption works because the decrypt side reconstructs the key stream from the recovered plaintext - which is exactly why the right key matters so much.
    • keep_formatting - the pack's usual spaces/punctuation/case toggle.

    Where people get burned

    The feedback property has a sharp edge: because the key stream depends on the plaintext, decrypting with even a slightly wrong key produces garbage immediately and the error compounds forward. There's no graceful "mostly right" outcome the way some transposition ciphers degrade. Also note the pack's shared preprocessing lowercases string keys and strips formatting before encrypting - so if you typed the key in mixed case, mentally lowercase it before comparing to an online tool.

    The other thing worth knowing: Autokey has multiple historical variants (some continue with the ciphertext, some with the plaintext - this one uses plaintext, the classic "Vigenère autokey"). If you're validating against a reference site, pick one that implements the plaintext-autokey variant or you'll swear the node is broken when it isn't.

    Installing it

    Standard pack install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
    

    Restart and find it under ARG Toolkit → Cryptography → Classical, or via ComfyUI Manager (search "ComfyUI ARG Toolkit"). Classical ciphers need secretpy - auto-installed by Manager, or pip install -r requirements.txt if you cloned by hand. Pure Python, no models.

    Troubleshooting

    • Decrypt is garbage from the start → key mismatch. Autokey doesn't do "close."
    • Doesn't match an online tool → confirm the tool implements plaintext-autokey (not ciphertext-autokey) and lowercase your key.
    • Want a sturdier modern option → Autokey is educational and fun; for something actually secure the pack's AESAuthenticated is the sibling to reach for.

    Autokey is the cipher that rewards the solver who notices the feedback loop - and the constructor who knows that a keyword plus a stream of its own plaintext is a nicer puzzle than a boring repeating key. It's a solid mid-tier ARG step.

    CategoryARG Toolkit/Cryptography/Classical

    Inputs (5)

    NameTypeDefaultDescription
    textSTRINGHello World!
    alphabetSTRINGENGLISHInput 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.
    modeBOOLEANtrueToggle between encrypting or decrypting a message.
    keep_formattingBOOLEANtrueToggle between preserving the format of the message or remove all spaces, punctuations, and convert to lowercase.
    keySTRINGAccepts any text in the alphabet's language as the key to decrypt/encrypt.

    Outputs (1)

    NameTypeDescription
    encrypted_txtSTRING