Scalar
Class Scalar
Scalar field element.
Methods
fromString
Creates a scalar object from a string representation of a scalar element.
fromString(group) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| group | string | ** |
| return | Scalar | ** |
toString
Returns the string representation of the scalar element.
toString() ► string
| Parameters | Type | Description |
|---|---|---|
| return | string | ** |
fromBytesLe
Create a scalar element from a Uint8Array of left endian bytes.
fromBytesLe(bytes) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| bytes | Uint8Array | ** |
| return | Scalar | ** |
toBytesLe
Encode the scalar element as a Uint8Array of left endian bytes.
toBytesLe() ► Uint8Array
| Parameters | Type | Description |
|---|---|---|
| return | Uint8Array | ** |
fromBitsLe
Reconstruct a scalar element from a boolean array representation.
fromBitsLe(bits) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| bits | Array.<any> | ** |
| return | Scalar | ** |
toBitsLe
Get the left endian boolean array representation of the scalar element.
toBitsLe() ► Array.<any>
| Parameters | Type | Description |
|---|---|---|
| return | Array.<any> | ** |
toPlaintext
Create a plaintext element from a scalar element.
toPlaintext() ► Plaintext
| Parameters | Type | Description |
|---|---|---|
| return | Plaintext | ** |
clone
Clone the scalar element.
clone() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
random
Generate a random scalar element.
random() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
add
Add two scalar elements.
add(other) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | Scalar | ** |
subtract
Subtract two scalar elements.
subtract(other) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | Scalar | ** |
multiply
Multiply two scalar elements.
multiply(other) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | Scalar | ** |
divide
Divide two scalar elements.
divide(other) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | Scalar | ** |
double
Double the scalar element.
double() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
pow
Power of a scalar element.
pow(other) ► Scalar
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | Scalar | ** |
inverse
Invert the scalar element.
inverse() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
one
Get the multiplicative identity of the scalar field.
one() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
zero
Get the additive identity of the scalar field.
zero() ► Scalar
| Parameters | Type | Description |
|---|---|---|
| return | Scalar | ** |
equals
Check if one scalar element equals another.
equals(other) ► boolean
| Parameters | Type | Description |
|---|---|---|
| other | Scalar | ** |
| return | boolean | ** |