Bitwise AND Operator
Combining Two Secrets Without Touching the Math
- bitwise_txt
Bitwise AND is one of the pack's bitwise operators, and it does exactly what the name promises: it takes two values, converts them to bytes, and ANDs them bit by bit - each bit of the result is 1 only where both inputs have a 1. In an ARG context this is a genuinely useful trick because bitwise operations are how a lot of "hidden in plain sight" puzzles work: you take a key byte and a message byte, combine them with AND/XOR, and the result only makes sense if you know both halves. The pack gives you the raw operator so you can build those tricks inside the graph instead of reaching for Python.
What makes this node slightly fancier than a raw operator is its auto-detection. Instead of forcing you to work in raw bytes, the datatype dropdown lets you hand it strings, hex, base64, integers, or binary - it parses both inputs in whatever format you pick, does the AND, and returns the result in the same format you came in with. So you can AND two hex strings and get hex back, or two binary strings and get binary back. That round-trip formatting is the whole quality-of-life difference.
The inputs that matter
text_1andtext_2- the two values. They must be in the samedatatype.datatype-String,Hexadecimal,Base64,Integer, orBinary. Pick the format of your inputs; the output follows.encoding_format- only relevant whendatatypeisString; it decides how the strings become bytes.other_encoding_format(optional) - the usual "type a Python codec name" escape hatch when you pickOther.
Output is bitwise_txt (STRING).
Where people get burned
The big one is length. AND is pairwise - byte 1 of input A is ANDed with byte 1 of input B - so the two inputs must be the same length, and the node raises a clear error ("Inputs must be same length for bitwise operations") if they aren't. This is the most common failure by far, because people try to AND a message with a shorter key. Fix: pad or align the inputs first (the pack has padding utilities for exactly this). Second: hex input is normalized (it tolerates 0x prefixes and spaces, pads odd-length strings), but base64 must be valid base64 and binary must be only 0s and 1s - malformed input gets a hard error, not a silent wrong answer. Third: don't confuse the format of the output - it matches the input format you chose, so if you AND'd strings you get a (possibly unprintable) string back, not a hex dump.
One honest note on security: AND is not a great standalone "encryption." Because a 0 in either input forces a 0 in the result, AND leaks information about the inputs. XOR is the operator people actually use for one-time-pad-style combining - but AND is what the puzzle calls for sometimes, and now it's a node.
Installing it
Standard ARG Toolkit install:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI and it's under ARG Toolkit → Utilities → Bitwise (ComfyUI Manager: search "ComfyUI ARG Toolkit"). Pure Python stdlib, no extra dependencies, no models.
Troubleshooting
- "Inputs must be same length" → pad or truncate one input. This is the classic stumble.
- Decode error on one input → it doesn't match the selected
datatype; check you didn't feed a hex string whiledatatypesays Base64. - Output is unreadable → that's expected for string datatype AND results; switch to Hex/Binary if you want to see the bits.
BitwiseAND is the tool you pull out when a puzzle hides data inside a byte-level combination of two things. Just keep the two inputs the same length and it'll behave.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| text_1 | STRING | Hello World! | The main string to compare against. Accepts format defined in `datatype` |
| text_2 | STRING | Hello World! | The secondary string to compare against. Accepts format defined in `datatype` |
| 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. | |
| 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 | — |