Bitwise OR Operator
Combine two strings bit-by-bit with the OR operator
- bitwise_txt
The Bitwise OR Operator takes two strings and produces a third where every byte is the logical OR of the two inputs: a bit is 1 if either input has a 1 there. In ARG and stego work that's less glamorous than XOR - it's not reversible, so it's not much use as a cipher primitive - but it's exactly what you need when a puzzle asks you to merge two layers of flags, overlay a bitmask, or combine a "header" value with per-byte "modifiers." Think of it as a crude image-mask operation, but on bytes.
The honest framing: OR is the operator you use when you want information to stick. Where XOR needs the same key on both sides to undo, OR is a one-way merge - the output is 1 wherever either input was 1, and you can't recover the original from the result. If your puzzle expects a reversible operation, you probably want the sibling BitwiseXOR node instead. If it expects bits to get set and stay set, this is the one.
How it works
Feed in two strings, and the node converts both to raw bytes using the datatype you pick, then walks them byte-by-byte applying x | y, and formats the result back into the same datatype. Two things to know before you wire anything up:
- Lengths must match. The node raises a
ValueError("Inputs must be same length for bitwise operations") iftext_1andtext_2decode to different byte counts. "Hello" vs "World!" is a difference of one byte and it will refuse. Pad or trim to equal length first. - It operates on bytes, not characters. Pick your
datatypeto match the problem.HexadecimalandBinaryare the sane choices for raw data;Stringmeans the bytes are UTF-8 and the output gets decoded back into text, which can blow up if the OR result isn't valid UTF-8.
The inputs that matter
text_1- the main string (the tooltip calls it "the main string to compare against").text_2- the secondary string. Same datatype requirement.datatype- interpretation of both inputs and the output:String,Hexadecimal,Base64,Integer,Binary.encoding_format- text encoding used only whendatatypeisString; defaults around utf-8, with anOtheroption backed byother_encoding_formatfor custom codecs.
Output is a single bitwise_txt string in the same format as the inputs.
Installing it
Part of the ComfyUI ARG Toolkit pack, so you get this node the moment you install the pack. In ComfyUI Manager, search "ComfyUI ARG Toolkit" and install; or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/AzelusLightvale/ComfyUI-ARG-Toolkit
Restart ComfyUI afterward. The pack's dependency list is heavier than its niche suggests - invisible-watermark drags in torch and opencv-python - so give the first install a minute. No models, no API keys, all local.
Gotchas
The same-length rule is the #1 trip-up, and it's easy to hit when both default values are "Hello World!" but you change one of them. Also keep the one-way nature in mind: OR never removes a bit that's already set, so it's a terrible choice for "undo" operations and a great choice for building a composite byte out of flag layers. If you're mid-puzzle and the output looks longer or wrong, double-check that both inputs actually decoded to equal-length byte strings rather than equal-looking text.
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 | — |