Group
Overview
Elliptic curve group element class for operations on group elements in the Aleo network. Provides methods for creating, converting, and manipulating group elements with support for various arithmetic operations and format conversions.
Methods
fromString
Creates a group object from a string representation of a group element
fromString(group) ► Group
| Param | Type | Description |
|---|---|---|
| group | string | String representation of a group element |
| return | Group | Group object |
toString
Returns the string representation of the group element
toString() ► string
| Param | Type |
|---|---|
| return | string |
fromBytesLe
Create a group element from a Uint8Array of left endian bytes
fromBytesLe(bytes) ► Group
| Param | Type | Description |
|---|---|---|
| bytes | Uint8Array | Byte array representation |
| return | Group | Group object |
toBytesLe
Encode the group element as a Uint8Array of left endian bytes
toBytesLe() ► Uint8Array
| Param | Type |
|---|---|
| return | Uint8Array |
fromBitsLe
Reconstruct a group element from a boolean array representation
fromBitsLe(bits) ► Group
| Param | Type | Description |
|---|---|---|
| bits | Array.<any> | Boolean array representation |
| return | Group | Group object |
toBitsLe
Get the left endian boolean array representation of the group element
toBitsLe() ► Array.<any>
| Param | Type |
|---|---|
| return | Array.<any> |
toFields
Get the field array representation of the group
toFields() ► Array.<any>
| Param | Type |
|---|---|
| return | Array.<any> |
toXCoordinate
Get the x-coordinate of the group element
toXCoordinate() ► Field
| Param | Type |
|---|---|
| return | Field |
toPlaintext
Create a plaintext element from a group element
toPlaintext() ► Plaintext
| Param | Type |
|---|---|
| return | Plaintext |
clone
Clone the group element
clone() ► Group
| Param | Type |
|---|---|
| return | Group |
random
Generate a random group element
random() ► Group
| Param | Type |
|---|---|
| return | Group |
add
Add two group elements
add(other) ► Group
| Param | Type | Description |
|---|---|---|
| other | Group | Group element to add |
| return | Group | Sum of the group elements |
subtract
Subtract two group elements (equivalently: add the inverse of an element)
subtract(other) ► Group
| Param | Type | Description |
|---|---|---|
| other | Group | Group element to subtract |
| return | Group | Difference of the group elements |
scalarMultiply
Multiply a group element by a scalar element
scalarMultiply(scalar) ► Group
| Param | Type | Description |
|---|---|---|
| scalar | Scalar | Scalar element to multiply by |
| return | Group | Result of scalar multiplication |
double
Double the group element
double() ► Group
| Param | Type |
|---|---|
| return | Group |
inverse
Get the inverse of the group element. This is the reflection of the point about the axis of symmetry i.e. (x,y) -> (x, -y)
inverse() ► Group
| Param | Type |
|---|---|
| return | Group |
equals
Check if one group element equals another
equals(other) ► boolean
| Param | Type | Description |
|---|---|---|
| other | Group | Group element to compare |
| return | boolean | Whether the group elements are equal |
zero
Get the group identity element under the group operation (i.e. the point at infinity)
zero() ► Group
| Param | Type |
|---|---|
| return | Group |
generator
Get the generator of the group
generator() ► Group
| Param | Type |
|---|---|
| return | Group |