Skip to main content

Field

Trait Field 

Source
pub trait Field:
    Sized
    + Eq
    + Copy
    + Clone
    + Default
    + Send
    + Sync
    + Debug
    + Display
    + Hash
    + 'static
    + Neg<Output = Self>
    + Add<Output = Self>
    + Sub<Output = Self>
    + Mul<Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + for<'a> Sub<&'a Self, Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + Sum
    + Product
    + for<'a> Sum<&'a Self>
    + for<'a> Product<&'a Self>
    + AddAssign
    + SubAssign
    + MulAssign
    + for<'a> AddAssign<&'a Self>
    + for<'a> SubAssign<&'a Self>
    + for<'a> MulAssign<&'a Self>
    + Square
    + InvertOrZero
    + Random
    + Zeroable
    + SerializeBytes
    + DeserializeBytes {
    const ZERO: Self;
    const ONE: Self;
    const CHARACTERISTIC: usize;
    const ORDER_EXPONENT: usize;
    const MULTIPLICATIVE_GENERATOR: Self;

    // Required method
    fn double(&self) -> Self;

    // Provided methods
    fn is_zero(&self) -> bool { ... }
    fn invert(&self) -> Option<Self> { ... }
    fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... }
}
Expand description

An element of a finite field.

A finite field (also called a Galois field) has order p^k where p is the CHARACTERISTIC and k is the ORDER_EXPONENT.

Required Associated Constants§

Source

const ZERO: Self

The zero element of the field, the additive identity.

Source

const ONE: Self

The one element of the field, the multiplicative identity.

Source

const CHARACTERISTIC: usize

The characteristic p of the field. The field order is p^k where k is ORDER_EXPONENT.

Source

const ORDER_EXPONENT: usize

The exponent k such that the field order equals CHARACTERISTIC^k.

Source

const MULTIPLICATIVE_GENERATOR: Self

Fixed generator of the multiplicative group.

Required Methods§

Source

fn double(&self) -> Self

Doubles this element.

Provided Methods§

Source

fn is_zero(&self) -> bool

Returns true iff this element is zero.

Source

fn invert(&self) -> Option<Self>

Computes the multiplicative inverse of this element, failing if the element is zero.

Source

fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self

Exponentiates self by exp, where exp is a little-endian order integer exponent.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Field for AESTowerField8b

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const CHARACTERISTIC: usize = 2

Source§

const ORDER_EXPONENT: usize = <u8 as crate::underlier::UnderlierType>::BITS

Source§

const MULTIPLICATIVE_GENERATOR: AESTowerField8b

Source§

impl Field for BinaryField1b

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const CHARACTERISTIC: usize = 2

Source§

const ORDER_EXPONENT: usize = <U1 as crate::underlier::UnderlierType>::BITS

Source§

const MULTIPLICATIVE_GENERATOR: BinaryField1b

Source§

impl Field for BinaryField128bGhash

Source§

const ZERO: Self

Source§

const ONE: Self

Source§

const CHARACTERISTIC: usize = 2

Source§

const ORDER_EXPONENT: usize = <u128 as crate::underlier::UnderlierType>::BITS

Source§

const MULTIPLICATIVE_GENERATOR: BinaryField128bGhash