NodeCrypto Help

Bitwise Logic

Category: Utility · Node Type ID: utility-bitwise

Performs bitwise logic (XOR, AND, OR) across byte arrays of equal length

Overview

Performs a byte-by-byte bitwise logical operation—Exclusive OR (XOR, $\oplus$), Logical AND (AND, $\wedge$), or Logical OR (OR, $\vee$)—across two or more byte arrays of equal byte length.

All connected input ports are evaluated left-associatively in top-to-bottom port order (Input_1 OP Input_2 OP ... OP Input_N). Every connected input buffer must have the exact same byte length; if any two connected inputs differ in length, execution halts with LENGTH_MISMATCH.

When to Use

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Operation
operation
select
Default: XOR
Always visible Selects the bitwise logic operator applied across all connected input byte arrays: XOR ($A \oplus B$), AND ($A \wedge B$), or OR ($A \vee B$).
  • XOR: XOR (Exclusive OR, ⊕)
  • AND: AND (Logical AND, ∧)
  • OR: OR (Logical OR, ∨)

Port I/O Specification

See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.

Input Ports

AttributeSpecification
Port NatureDynamic / Variable Input Ports
Initial Default on CanvasStarts with 2 initial convenience input ports (Input A, id: in_a and Input B, id: in_b) on the canvas. These are initial default dynamic ports, not fixed ports.
Port Count RangeMinimum 2 connected input ports; supports 3 or more inputs via [+].
Allowed Data TypesBytes only (all connected inputs must have the exact same byte length).
Adding & Managing PortsAdd additional operand ports by dragging a Bytes wire onto the [+] handle or via the inspector; rename or remove extra ports in the inspector.
Evaluation & Ordering RuleBitwise XOR, AND, and OR are associative and commutative across all connected input buffers.

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
Result result Bytes Always visible Resulting byte array (Uint8Array) of the same byte length as the connected inputs.

Error Cases

When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute.

Error CodeDefault Engine MessageTrigger Condition
BYTES_LENGTH_MISMATCH Two values that must be the same length differ in length Raised when connected byte array operands do not all have the exact same byte length.

Examples

Combining Three 16-Byte Key Shares with XOR

Reconstruct a secret key from three equal-length XOR shares.

  1. Set Operation to XOR (Exclusive OR, ⊕).
  2. Connect Share 1 to Input A, Share 2 to Input B, and drag Share 3 onto the [+] handle to create a third input port.
  3. The Result port outputs Share1 ⊕ Share2 ⊕ Share3.