Skip to main content

Scalar

Class Scalar

Scalar field element.

Methods

fromString

Creates a scalar object from a string representation of a scalar element.

fromString(group)Scalar
ParametersTypeDescription
groupstring**
returnScalar**

toString

Returns the string representation of the scalar element.

toString() ► string
ParametersTypeDescription
returnstring**

fromBytesLe

Create a scalar element from a Uint8Array of left endian bytes.

fromBytesLe(bytes)Scalar
ParametersTypeDescription
bytesUint8Array**
returnScalar**

toBytesLe

Encode the scalar element as a Uint8Array of left endian bytes.

toBytesLe()Uint8Array
ParametersTypeDescription
returnUint8Array**

fromBitsLe

Reconstruct a scalar element from a boolean array representation.

fromBitsLe(bits)Scalar
ParametersTypeDescription
bitsArray.<any>**
returnScalar**

toBitsLe

Get the left endian boolean array representation of the scalar element.

toBitsLe()Array.<any>
ParametersTypeDescription
returnArray.<any>**

toPlaintext

Create a plaintext element from a scalar element.

toPlaintext()Plaintext
ParametersTypeDescription
returnPlaintext**

clone

Clone the scalar element.

clone()Scalar
ParametersTypeDescription
returnScalar**

random

Generate a random scalar element.

random()Scalar
ParametersTypeDescription
returnScalar**

add

Add two scalar elements.

add(other)Scalar
ParametersTypeDescription
otherScalar**
returnScalar**

subtract

Subtract two scalar elements.

subtract(other)Scalar
ParametersTypeDescription
otherScalar**
returnScalar**

multiply

Multiply two scalar elements.

multiply(other)Scalar
ParametersTypeDescription
otherScalar**
returnScalar**

divide

Divide two scalar elements.

divide(other)Scalar
ParametersTypeDescription
otherScalar**
returnScalar**

double

Double the scalar element.

double()Scalar
ParametersTypeDescription
returnScalar**

pow

Power of a scalar element.

pow(other)Scalar
ParametersTypeDescription
otherScalar**
returnScalar**

inverse

Invert the scalar element.

inverse()Scalar
ParametersTypeDescription
returnScalar**

one

Get the multiplicative identity of the scalar field.

one()Scalar
ParametersTypeDescription
returnScalar**

zero

Get the additive identity of the scalar field.

zero()Scalar
ParametersTypeDescription
returnScalar**

equals

Check if one scalar element equals another.

equals(other) ► boolean
ParametersTypeDescription
otherScalar**
returnboolean**