Class: BitConverter

BitConverter()

Converts from/to: byte arrays, integral values, and hex strings.

Constructor

new BitConverter()

Source:

Methods

(static) hexToBytes(data) → {Uint8Array}

Convert a hex string to a byte array.
Parameters:
Name Type Description
data string The hex string to be converted.
Source:
Returns:
The byte array converted from the string.
Type
Uint8Array

(static) toBytes(value, length) → {Uint8Array}

Converts a long value to byte array.
Parameters:
Name Type Description
value number The value to be converted.
length number The length of the byte array to be returned.
Source:
Returns:
A byte array representation of the value.
Type
Uint8Array

(static) toHex(data) → {string}

Convert a byte array to a hex representation.
Parameters:
Name Type Description
data Uint8Array The byte array to be converted.
Source:
Returns:
The hex string representation.
Type
string

(static) toLong(bytes, index, length) → {number}

Converts a byte array to a long value. Little endian only.
Parameters:
Name Type Description
bytes Uint8Array The byte array to be converted.
index number The starting index of the data in the array that will be converted.
length number The length of the data that will be converted.
Source:
Returns:
The long value representation of the byte array.
Type
number