NodeCrypto Help

Hex to Bytes

Category: Data Conversion & Encoding ยท Node Type ID: converter-hex-to-bytes

Decodes a hexadecimal string into a raw byte array

Overview

Decodes a hexadecimal string into a raw byte array (Uint8Array). The parser automatically strips an optional leading 0x or 0X prefix as well as common byte separators (spaces, colons :, hyphens -, and newlines) before validating and decoding each pair of hex digits.

An empty string (after stripping prefixes/separators) decodes to a 0-byte Uint8Array. If the cleaned string has an odd number of hex digits or contains any character outside 0-9a-fA-F, execution halts with INVALID_HEX_STRING.

When to Use

Parameter Configuration

This node has no configurable static parameters in the property inspector; its runtime behavior is determined entirely by its algorithm specification and connected ports.

Port I/O Specification

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

Input Ports

Port Nature: Fixed Input Ports (1 total).

Port NamePort IDData TypeRequiredVisibility ConditionDescription
Hex In string String Required Always visible Hexadecimal string to decode (supports optional 0x prefix and space/colon/hyphen delimiters).

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
Bytes Out bytes Bytes Always visible Decoded raw byte array (Uint8Array).

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
INVALID_HEX_LENGTH Hex string length is not even Raised when the hexadecimal string (excluding whitespace and 0x prefix) has an odd number of digits.
INVALID_HEX_CHAR Hex string contains an invalid character Raised when the hexadecimal string contains characters outside 0-9, a-f, and A-F.

Examples

Decoding a Colon-Separated Hex Key String

Convert "00:01:02:03" into a 4-byte Uint8Array.

  1. Feed the string "00:01:02:03" into the Hex String input port.
  2. The Bytes output port emits the 4-byte array [0x00, 0x01, 0x02, 0x03].