Nodes/ComfyUI ARG Toolkit/Columnar Transposition Cipher
ComfyUI Node

Columnar Transposition Cipher

The keyword cipher that scrambles by column

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

    Columnar transposition is the cipher that reorders text instead of replacing it: you write the message into a grid row by row, then read it back out column by column, with the order of the columns decided by a keyword. The letters all survive - nothing is substituted - but the sequence is scrambled so thoroughly that it reads as gibberish. It's one of the classic "looks random but isn't" ciphers, which is precisely why ARG designers love it: hand solvers a keyword and they can recover the message; hide the keyword and they're stuck on a frequency-analysis-proof wall.

    In the ARG Toolkit it lives in the Classical category alongside the substitution ciphers, powered by the same secretpy base, but it's worth understanding that it's a different species of cipher. Substitution changes what each letter is; transposition changes where each letter sits. That distinction matters for solving: frequency analysis that cracks a Caesar does nothing here, and the way you attack a columnar transposition is by guessing the keyword length and rearranging columns - which is why the key field behaves differently than the numeric keys of the ROT family.

    How it works

    The node wraps secretpy.ColTrans. The key is a word (the tooltip: "accepts any text in the alphabet's language"), and its letters' alphabetical order determines the column-reading order. The cipher text is laid into a grid whose width equals the key's length, then columns are read in the order the key's letters sort. Decryption reverses the whole process, so the same key and mode = decrypt restore the original.

    Because it shares the base node, you get the familiar supporting cast: alphabet (default ENGLISH, or a custom connected alphabet), mode (encrypt/decrypt), and keep_formatting - on by default, preserving spaces and case; off, stripping everything to lowercase letters. One thing to remember: with keep_formatting on, the spaces and punctuation survive the scramble in place, so the ciphertext keeps its visible word boundaries - which makes it look friendlier, but also gives solvers a hint about the plaintext's shape.

    The inputs that matter

    • text - the message.
    • key - the keyword that sets column order. This is the input you must get right on both ends; a different keyword means a different scramble.
    • alphabet - ENGLISH by default; custom alphabets supported.
    • mode - encrypt/decrypt toggle.
    • keep_formatting - preserve spacing/case or strip to lowercase.

    Output: a single encrypted_txt string.

    Installing it

    Part of the ComfyUI ARG Toolkit pack. Install via ComfyUI Manager (search "ComfyUI ARG Toolkit") or:

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

    Restart ComfyUI. Pack-wide install: secretpy plus cryptography, stegano, invisible-watermark, reedsolo, and transitive torch/opencv-python. No models, no API keys.

    Gotchas

    The keyword is everything - wrong key, wrong output, with no warning. And since this is a transposition, don't expect letter frequencies to change: if your "ciphertext" has the same letter distribution as normal English, that's the tell that it's a transposition cipher and you should be attacking column order rather than substitution. As with the other classical nodes here, the author is upfront that this is a hobbyist project tested on common cases, so if an exotic alphabet misbehaves, verify against a reference before you trust the node.

    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