Static
_isStatic
checkAdd assertions to the proof to check if value
is a valid member of type T
.
This function does not return anything, instead it creates any number of assertions to prove that value
is a valid member of the type T
.
For instance, calling check function on the type Bool asserts that the value of the element is either 1 or 0.
the element of type T
to put assertions on.
Static
Readonly
COL_Static
emptyStatic
fromStatic
fromJSONStatic
fromConvert provable type from a normal JS type.
Static
toA function that takes value
(optional), an element of type T
, as argument and
returns an array of any type that make up the "auxiliary" (non-provable) data of value
.
Optional
value: { value: Field[][] }the element of type T
to generate the auxiliary data array from, optional.
If not provided, a default value for auxiliary data is returned.
An array of any type describing how this T
element is made up of "auxiliary" (non-provable) data.
Static
Optional
toOptional method which transforms a provable type into its canonical representation.
This is needed for types that have multiple representations of the same underlying value, and might even not have perfect completeness for some of those representations.
An example is the ForeignField
class, which allows non-native field elements to exist in unreduced form.
The unreduced form is not perfectly complete, for example, addition of two unreduced field elements can cause a prover error.
Specific protocols need to be able to protect themselves against incomplete operations at all costs.
For example, when using actions and reducer, the reducer must be able to produce a proof regardless of the input action.
toCanonical()
converts any input into a safe form and enables us to handle cases like this generically.
Note: For most types, this method is the identity function.
The identity function will also be used when the toCanonical()
is not present on a type.
Static
toA function that takes value
, an element of type T
, as argument and returns
an array of Field elements that make up the provable data of value
.
the element of type T
to generate the Field array from.
A Field array describing how this T
element is made up of Field elements.
Static
toStatic
toJSONStatic
toConvert provable type to a normal JS type.
Performs equality check on two Byte16 values.
Another Byte16 instance.
Converts the Byte16 instance back into an array of 16 bytes. NONPROVABLE: This function should only be used for testing purposes. The output is in AES column‑major order.
An array of 16 numbers, each between 0 and 255.
Converts a Byte16 instance into a 4x4 matrix of Field elements (each one byte) in standard AES column‑major order.
A 4x4 matrix of Field elements.
Returns a Field representation of the full 128-bit value.
Field representation of the Byte16 instance.
Converts the Byte16 instance into a 32-character hex string. NONPROVABLE: For testing only.
A 32-character hex string.
Static
fromConverts a BigInt value into a Byte16 instance. NONPROVABLE: Can be used as witness
the big integer to convert, must be 128 bits
new Byte16 class
Static
fromConverts an array of 16 bytes into a Byte16 instance. NONPROVABLE: This function should only be used for testing purposes.
Assumes the input is in AES column‑major order:
An array of 16 numbers, each between 0 and 255.
A Byte16 instance.
Static
fromConverts a 4x4 matrix (in column‑major order) into a Byte16 instance.
4x4 matrix of byte‑sized Field elements.
A Byte16 instance.
Static
fromConverts a Field value into a Byte16 instance.
field must fit into 128 bits, otherwise behaviour is undefined
A Byte16 instance representing the field value.
Static
fromConverts a 32-character hex string into a Byte16 instance. NONPROVABLE: For testing only.
The hex string must be 32 characters long.
A 32-character hex string.
A Byte16 instance.
Static
sizeReturn the size of the T
type in terms of Field type, as Field is the primitive type.
A number
representing the size of the T
type in terms of Field type.
Static
xorStatic
Zero
Represents a 128-bit field element for AES encryption