Bitwise NOT Operator
The unary NOT that reverses bit patterns
- bitwise_txt
The Bitwise NOT Operator is the one-node answer to "what if every 1 became a 0?" It flips every bit in your input - 0→1, 1→0 - and hands back the result in the same format you fed it. In an ARG-solving workflow this is the node you reach for when a hint says something like "invert the message before XOR," or when a puzzle hands you binary that only makes sense bit-flipped. It's also a fast way to check whether "garbled" text is actually just the byte-wise complement of something legible - a common stego gag that looks like noise until you invert it.
The one input quirk that makes this different from the rest of the bitwise family: NOT is unary, so it takes a single text and no text_2. The sibling AND/OR/XOR/RS nodes all want two strings; this one just chews through whatever you give it.
How it works
Under the hood it's dead simple - a per-byte (~x & 0xFF) pass over the data. The & 0xFF matters: a raw Python ~ on a byte gives you a negative number, and the mask keeps everything in unsigned 8-bit land, which is what you actually want when you're manipulating bytes. The node converts your text into raw bytes according to the datatype you picked, flips each one, then converts back to that same format for the output.
That conversion step is the part to pay attention to. datatype has five choices - String, Hexadecimal, Base64, Integer, Binary - and the operation always happens on the bytes, not on the text you typed. So if you pick String with utf-8 encoding, the node flips raw UTF-8 bytes and then tries to decode the result back into text. Sometimes that works and looks like garbage-cipher; sometimes it raises a UnicodeDecodeError because flipped UTF-8 bytes aren't valid text. If you're doing real byte work, pick Hexadecimal, Binary, or Base64 instead and you'll dodge that entire failure mode.
The inputs that matter
text- the single string to invert. The tooltip spells it out: accepts whatever format you chose indatatype.datatype- howtext(and the output) should be interpreted.HexadecimalandBinaryare the ones you'll want for most puzzle work.encoding_format- only relevant whendatatypeisString. The dropdown includes utf-8, utf-16, utf-32, ascii, latin-1, cp1252, utf-8-sig, andOther; pickOtherand fill inother_encoding_formatif you need something exotic.
Everything flows out through one output, bitwise_txt, a string in the same format as your input - wire it straight into the next cipher node or a text previewer.
Installing it
This ships inside the ComfyUI ARG Toolkit pack, so install the pack once and you get all of these nodes. Easiest path is ComfyUI Manager - search for "ComfyUI ARG Toolkit" and hit install. Manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Then restart ComfyUI. The pack pulls in a real dependency list (cryptography, secretpy, stegano, invisible-watermark, reedsolo, plus heavy transitive bits like torch and opencv-python), so the first install can take a couple of minutes. There are no model files to download and no API keys - the whole pack runs locally on pure math.
Gotchas
Beyond the String-datatype decode error above, the two things people actually hit: the pack's bitwise nodes demand same-length inputs on the two-operand ops, but NOT has no such constraint since there's only one operand. And remember the output is flipped in the same format as the input - if you feed it a hex string you get hex out, not decimal. Bitwise NOT is its own inverse, so running the result through the node a second time gives you back the original. That's a nice self-check when you're not sure a string was actually inverted in the first place.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| datatype | COMBO | Binary | The datatype that the two texts is assumed to be for comparison purpose. Will also output the final output based on the chosen datatype as well. |
| encoding_format | COMBO | The encoding format available for text, may yield different results when converting. | |
| text | STRING | Hello World! | The main string to compare against. Accepts format defined in `datatype` |
| other_encoding_formatopt | STRING | If, for some reason, your chosen encoding format is not available in the dropdown, select "Other" in encoding_format and type in your encoding format here. Supports all format written in Python's `encoding` module. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| bitwise_txt | STRING | — |