Nodes/ComfyUI ARG Toolkit/Scytale Cipher
ComfyUI Node

Scytale Cipher

An ancient transposition you can explain in one sentence

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

    The scytale is one of the oldest ciphers on record - a Spartan military device from before 500 BCE that worked by wrapping a strip of leather around a wooden rod and writing along it. Unwrap the strip and the message is a scrambled ribbon of letters; re-wrap it on the same diameter rod and the message reappears. This node is that rod, digitized. For an ARG that wants a "here's an ancient cipher, figure out the trick" puzzle, this is the gentlest possible entry point: no substitution, no frequency analysis, just rearranging.

    It's a transposition cipher, not a substitution - the letters stay themselves, they just get reordered. That's the whole genre, and the scytale is the cleanest example of it.

    How it works

    The node is built on the secretpy library, which handles the actual encrypt/decrypt. Inputs:

    • text - your message.
    • key - an integer, and here's the mental model: it's the number of windings around the cylinder, i.e. the number of rows the message is written into. Default 4.
    • mode - boolean toggle: on = encrypt, off = decrypt.
    • keep_formatting - boolean, default on. On preserves your spaces, punctuation, and capitalization; off strips everything to lowercase letters only.
    • alphabet - defaults to ENGLISH; you can supply a custom alphabet string, or leave it and it uses the cipher's default.

    Output is encrypted_txt, a STRING.

    The one thing to internalize: the key is a number of rows, and the same key both scrambles and unscrambles. Give the solver the key and the cipher name and you've handed them the full solution path.

    The inputs that matter

    For a beginner, text, key, and the mode toggle are the whole node. keep_formatting is a genuine choice, though: leave it on and your ciphertext still has spaces and capital letters (easier to read, easier to crack); turn it off and you get a solid block of lowercase ciphertext, which is how classical ciphers were usually delivered. The alphabet field you can ignore forever unless you're doing a non-Latin puzzle.

    Installing it

    Part of ComfyUI ARG Toolkit - ComfyUI Manager (search "ComfyUI ARG Toolkit") or:

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

    Restart ComfyUI. Classical ciphers here run on secretpy, which Manager installs; no model files.

    Common issues

    • Decrypt produces garbage - wrong key (wrong number of rows). With transposition, even a key off by one scrambles everything.
    • The decrypt button does nothing obvious - remember mode is a toggle with "encrypt"/"decrypt" labels; if you flipped it the wrong way you'll get a different-looking block of text instead of your original.
    • For puzzle design, be aware the scytale is trivially breakable by trying row counts - that's fine for a warm-up ARG, but if you want a real challenge, the pack's Playfair-family nodes (TwoSquare, ThreeSquare) are the next rung up.
    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.
    keyINT4For Scytale cipher, the key indicates the number of windings around the cylinder the message should have.

    Outputs (1)

    NameTypeDescription
    encrypted_txtSTRING