NodeCrypto Help

Bytes to Int

Category: Data Conversion & Encoding · Node Type ID: utility-bytes-to-int

Interprets bytes as an unsigned integer (bigint when beyond the safe range)

Overview

Interprets a raw byte array (Uint8Array) of any length as an unsigned integer (Int / bigint) according to the selected Endian byte order (Big-Endian or Little-Endian). An empty (0-byte) input buffer evaluates to 0.

Because NodeCrypto represents Int values at runtime using arbitrary-precision bigint when values exceed the 53-bit JavaScript safe integer limit, this node can losslessly decode 128-bit counters, 256-bit hashes, or 2048-bit RSA moduli into integers.

When to Use

Parameter Configuration

Parameter (ID)Type & DefaultVisibility ConditionDescription & Options
Endian
endian
select
Default: big
Always visible Byte order used to interpret the input buffer: big (first byte is most significant) or little (first byte is least significant).
  • big: Big Endian — interprets the first byte as the most significant byte (network byte order).
  • little: Little Endian — interprets the first byte as the least significant byte.

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
Bytes in Bytes Required Always visible

Output Ports

Port Nature: Fixed Output Ports (1 total).

Port NamePort IDData TypeVisibility ConditionDescription
Value out Int Always visible

Error Cases

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

Examples

Reading a 2-Byte Big-Endian Length Header

Slice the first 2 bytes of a packet and decode them as an integer length.

  1. Use Byte Slicer (Offset = 0, Length = 2) to extract the header bytes.
  2. Connect the slice to Bytes to Int with Endian set to Big Endian.