Skip to main content

Class: BigIntHelper

Helper methods for bigints.

Table of contents

Methods

Constructors

Methods

read3

Static read3(data, byteOffset): BigInteger

Load 3 bytes from array as bigint.

Parameters

NameTypeDescription
dataUint8ArrayThe input array.
byteOffsetnumberThe start index to read from.

Returns

BigInteger

The bigint.


read4

Static read4(data, byteOffset): BigInteger

Load 4 bytes from array as bigint.

Parameters

NameTypeDescription
dataUint8ArrayThe input array.
byteOffsetnumberThe start index to read from.

Returns

BigInteger

The bigint.


read8

Static read8(data, byteOffset): BigInteger

Load 8 bytes from array as bigint.

Parameters

NameTypeDescription
dataUint8ArrayThe data to read from.
byteOffsetnumberThe start index to read from.

Returns

BigInteger

The bigint.


read32

Static read32(data, byteOffset): BigInteger

Load 32 bytes (256 bits) from array as bigint.

Parameters

NameTypeDescription
dataUint8ArrayThe data to read from.
byteOffsetnumberThe start index to read from.

Returns

BigInteger

The bigint.


write8

Static write8(value, data, byteOffset): void

Convert a big int to bytes.

Parameters

NameTypeDescription
valueBigIntegerThe bigint.
dataUint8ArrayThe buffer to write into.
byteOffsetnumberThe start index to write from.

Returns

void


write32

Static write32(value, data, byteOffset): void

Convert a big int 32 bytes (256 bits) to bytes.

Parameters

NameTypeDescription
valueBigIntegerThe bigint.
dataUint8ArrayThe buffer to write into.
byteOffsetnumberThe start index to write from.

Returns

void


random

Static random(length?): BigInteger

Generate a random bigint.

Parameters

NameTypeDefault valueDescription
lengthnumber8The length of the bigint to generate.

Returns

BigInteger

The bigint.

Constructors

constructor

new BigIntHelper()