NodeCrypto Help

String to Bytes

Category: Data Conversion & Encoding · Node Type ID: converter-string-to-bytes

Encodes text string into raw byte array using specified charset

Overview

Encodes a text string into a raw byte array (Uint8Array) using the selected character encoding (utf-8, ascii, or latin1 / ISO-8859-1).

Because cryptographic primitives (ciphers, hashes, MACs, and digital signatures) operate on exact byte sequences rather than abstract Unicode strings, use this node whenever you want to encrypt, hash, or sign human-readable text.

When to Use

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Character Encoding
encoding
select
Default: utf-8
Always visible Character encoding used to serialize the string: utf-8 (variable-width 1–4 bytes per code point), ascii (low 7 bits per character), or latin1 (low 8 bits per character 0x00..0xFF).
  • utf-8: UTF-8 (Standard)
  • ascii: ASCII (7-bit)
  • latin1: Latin-1 (ISO-8859-1)

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
String In string String Required Always visible Input text string to encode.

Output Ports

Port Nature: Fixed Output Ports (1 total).

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

Error Cases

This node has no runtime failure cases (errorProfile: none) and always succeeds for any valid typed input.

Examples

Encoding a UTF-8 Message for Hashing or Encryption

Convert a text string into bytes before feeding it to SHA-256.

  1. Connect a String source to String to Bytes (Character Encoding = UTF-8).
  2. Connect the Bytes output port to the Data input port of Hash Digest.