../../.cargo/katex-header.html
pub struct BaseElement(_);
Expand description

Represents base field element in the field.

Internal values are stored in the range [0, 2^64). The backing type is u64.

Implementations

Creates a new field element from the provided value; the value is converted into Montgomery representation.

Returns a new field element from the provided ‘value’. Assumes that ‘value’ is already in canonical Montgomery form.

Returns the non-canonical u64 inner value.

Computes an exponentiation to the power 7. This is useful for computing Rescue-Prime S-Box over this field.

Trait Implementations

The resulting type after applying the + operator.
Performs the + operation. Read more
Performs the += operation. Read more
Returns a byte representation of self. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into Self, and returns the result. Read more
Reads a sequence of bytes from the provided source, attempts to deserialize these bytes into a vector with the specified number of Self elements, and returns the result. Read more
Formats the value using the given formatter. Read more
The resulting type after applying the / operator.
Performs the / operation. Read more
Performs the /= operation. Read more

Defines a quadratic extension of the base field over an irreducible polynomial x2 - x + 2. Thus, an extension element is defined as α + β * φ, where φ is a root of this polynomial, and α and β are base field elements.

Returns a product of a and b in the field defined by this extension.
Returns a product of a and b in the field defined by this extension. b represents an element in the base field. Read more
Returns Frobenius automorphisms for x in the field defined by this extension.
Returns true if this extension is supported for the underlying base field.

Defines a cubic extension of the base field over an irreducible polynomial x3 - x - 1. Thus, an extension element is defined as α + β * φ + γ * φ^2, where φ is a root of this polynomial, and α, β and γ are base field elements.

Returns a product of a and b in the field defined by this extension.
Returns a product of a and b in the field defined by this extension. b represents an element in the base field. Read more
Returns Frobenius automorphisms for x in the field defined by this extension.
Returns true if this extension is supported for the underlying base field.
A type defining positive integers big enough to describe a field modulus for Self::BaseField with no loss of precision. Read more
Base field type for this finite field. For prime fields, BaseField should be set to Self. Read more
The additive identity.
The multiplicative identity.
Number of bytes needed to encode an element
True if internal representation of the element is the same as its canonical representation.
Returns this field element added to itself.
Exponentiates this field element by power parameter.
Returns a multiplicative inverse of this field element. If this element is ZERO, ZERO is returned. Read more
Returns a conjugate of this field element.
Converts a list of elements into a list of bytes. Read more
Converts a list of bytes into a list of field elements. Read more
Returns a vector of length n initialized with all ZERO elements. Read more
Converts a list of field elements into a list of elements in the underlying base field. Read more
Returns this field element raised to power 2.
Returns this field element raised to power 3.

Converts the value encoded in an array of 8 bytes into a field element. The bytes are assumed to encode the element in the canonical representation in little-endian byte order. If the value is greater than or equal to the field modulus, modular reduction is silently performed.

Converts a 128-bit value into a field element.

Converts a 16-bit value into a field element.

Converts a 32-bit value into a field element.

Converts a 64-bit value into a field element. If the value is greater than or equal to the field modulus, modular reduction is silently performed.

Converts an 8-bit value into a field element.

The resulting type after applying the * operator.
Performs the * operation. Read more
Performs the *= operation. Read more
The resulting type after applying the - operator.
Performs the unary - operation. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Size of Self in bytes. Read more
Returns Self if the set of bytes forms a valid value, otherwise returns None.
Serializes self into bytes and writes these bytes into the target.
Serializes self into a vector of bytes.
Serializes all elements of the source and writes these bytes into the target. Read more
Returns an estimate of how many bytes are needed to represent self. Read more

sage: MODULUS = 2^64 - 2^32 + 1
sage: GF(MODULUS).is_prime_field()
True
sage: GF(MODULUS).order()
18446744069414584321

sage: GF(MODULUS).primitive_element()
7

sage: is_odd((MODULUS - 1) / 2^32)
True

sage: k = (MODULUS - 1) / 2^32
sage: GF(MODULUS).primitive_element()^k
1753635133440165772

The number of bits needed to represents Self::MODULUS.
Returns byte representation of the field modulus in little-endian byte order.
Returns a canonical integer representation of this field element.
Returns the root of unity of order 2^n. Read more
The resulting type after applying the - operator.
Performs the - operation. Read more
Performs the -= operation. Read more

Converts a slice of bytes into a field element; returns error if the value encoded in bytes is not a valid field element. The bytes are assumed to encode the element in the canonical representation in little-endian byte order.

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.