ComfyUI Node

Vic Cipher

The Soviet spy cipher that's hiding a landmine under its default settings

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

    The VIC cipher is the one classical cipher that actually earned its scary reputation - a Soviet spy cipher so fiddly that its namesake, Reino Häyhänen (codenamed "VICTOR"), kept a cheat sheet on a coin for it. In the ARG Toolkit it's the node that looks like the crown jewel of the cryptography section and is currently the least likely to run. Straight talk: as shipped, this node throws IndexError: list index out of range with its default settings. I ran the actual code path against the pinned secretpy version the pack ships and it dies every single time at alphabet setup. If you're here to decrypt a VIC ciphertext and it fails instantly, that's the node, not you.

    The VIC cipher is a digit-driven straddling checkerboard: letters get mapped to single- or double-digit codes, the digits get shuffled through transposition, and a key digits string shifts the result. It was famously complex for a pencil-and-paper cipher, which is the whole point - it's a classic ARG flex. Fair warning, though: what this node actually implements is secretpy's simplified Vic, a digit-keyed bifid-style substitution. It's a distant cousin of the full five-step Cold War procedure the author's own docs describe, so treat it as a flavor of the real thing, not the real thing.

    The inputs are the standard classical-cipher quartet plus a numeric key:

    • text - the message, multiline, defaults to "Hello World!".
    • mode - true encrypts, false decrypts. One toggle, easy to forget to flip on the way back.
    • keep_formatting - true keeps spaces, punctuation, and capitalization; false strips everything and lowercases before encrypting. For ciphers this is usually the "readable output" switch, but it also changes the ciphertext, so both sides of a round trip need to agree.
    • key - the tooltip says "a string of numbers (punctuation optional), anything not a number is ignored."
    • alphabet - default ENGLISH, but you can paste your own connected alphabet like abcdefghijklmnopqrstuvwxyz or use any name from secretpy.alphabets.

    Output is one encrypted_txt string, ready to feed into a text display node or the pack's converter nodes.

    Now the part you actually need. The IndexError happens because secretpy's Vic builds its substitution table from a 10-column grid and expects blank marker cells in the alphabet to signal row breaks. None of the predefined alphabets have them, so the moment the cipher hits a letter in the second row, it tries to index an empty list and explodes. I verified that a 30-cell alphabet with blank slots at positions 0, 10, and 20 does run the underlying cipher - so there's a workaround if you're determined, but you're swimming against the current. There's also a second quirk waiting behind it: the node's key preprocessing line does str(int(ch) for ch in key if ch.isdigit()), which converts a generator object to a string rather than joining the digits. The tooltip's "anything not a number is ignored" promise isn't quite what the code does. As of pack v2.2.1, treat this node as broken-in-box and reach for Vigenere or Zigzag in the same pack instead - they actually work.

    Install is the usual ComfyUI story: ComfyUI Manager → search "ComfyUI ARG Toolkit" → install → restart, or:

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

    The pack is GPLv3 and one-author (AzelusLightvale), and its README is refreshingly honest that it started as an amateur project with tests covering only common cases - which is exactly the kind of caveat you should read twice before relying on a specific cipher node. The full pack pulls in secretpy, cryptography, stegano, invisible-watermark, and reedsolo, and the watermark dependency drags torch and opencv along with it, so first load is slow even if the node itself is tiny.

    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 a string of numbers (punctuation optional) as the first key to decrypt/encrypt. Note that anything not a number is ignored.

    Outputs (1)

    NameTypeDescription
    encrypted_txtSTRING