Struct scuttlebutt::field::F2

source ·
pub struct F2(/* private fields */);
Expand description

A field element in the prime-order finite field $\textsf{GF}(2).$

Trait Implementations§

source§

impl<'a> Add<&'a F2> for F2

§

type Output = F2

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'a F2) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add<F2> for &'a F2

§

type Output = F2

The resulting type after applying the + operator.
source§

fn add(self, rhs: F2) -> Self::Output

Performs the + operation. Read more
source§

impl<'a> Add for &'a F2

§

type Output = F2

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'a F2) -> Self::Output

Performs the + operation. Read more
source§

impl Add for F2

§

type Output = F2

The resulting type after applying the + operator.
source§

fn add(self, rhs: F2) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign<&F2> for F2

source§

fn add_assign(&mut self, rhs: &F2)

Performs the += operation. Read more
source§

impl AddAssign for F2

source§

fn add_assign(&mut self, rhs: F2)

Performs the += operation. Read more
source§

impl CanonicalSerialize for F2

source§

fn to_bytes(&self) -> GenericArray<u8, Self::ByteReprLen>

Return the canonical byte representation (byte representation of the reduced field element).

§

type Serializer = F2BitSerializer

A way to serialize field elements of this type. Read more
§

type Deserializer = F2BitDeserializer

A way to deserialize field elements of this type. Read more
§

type ByteReprLen = UInt<UTerm, B1>

The number of bytes in the byte representation for this element.
§

type FromBytesError = BiggerThanModulus

The error that can result from trying to decode an invalid byte sequence.
source§

fn from_bytes( buf: &GenericArray<u8, Self::ByteReprLen> ) -> Result<Self, BiggerThanModulus>

Deserialize an element from a byte array. Read more
source§

impl Clone for F2

source§

fn clone(&self) -> F2

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConditionallySelectable for F2

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl ConstantTimeEq for F2

source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
source§

impl Debug for F2

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for F2

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for F2

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl Distribution<F2> for Standard

source§

fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> F2

Generate a random value of T, using rng as the source of randomness.
source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
source§

fn map<F, S>(self, func: F) -> DistMap<Self, F, T, S>
where F: Fn(T) -> S, Self: Sized,

Create a distribution of values of ‘S’ by mapping the output of Self through the closure F Read more
source§

impl<'a> Div<&'a F2> for F2

§

type Output = F2

The resulting type after applying the / operator.
source§

fn div(self, rhs: &'a F2) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> Div<F2> for &'a F2

§

type Output = F2

The resulting type after applying the / operator.
source§

fn div(self, rhs: F2) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> Div for &'a F2

§

type Output = F2

The resulting type after applying the / operator.
source§

fn div(self, rhs: &'a F2) -> Self::Output

Performs the / operation. Read more
source§

impl Div for F2

§

type Output = F2

The resulting type after applying the / operator.
source§

fn div(self, rhs: F2) -> Self::Output

Performs the / operation. Read more
source§

impl<'a> DivAssign<&'a F2> for F2

source§

fn div_assign(&mut self, rhs: &Self)

Performs the /= operation. Read more
source§

impl DivAssign for F2

source§

fn div_assign(&mut self, rhs: F2)

Performs the /= operation. Read more
source§

impl FiniteField for F2

§

type PrimeField = F2

The prime-order subfield of the finite field.
source§

const GENERATOR: Self = _

The generator for the multiplicative group.
source§

fn polynomial_modulus() -> Polynomial<Self::PrimeField>

Multiplication over field elements should be reduced over this polynomial.
§

type NumberOfBitsInBitDecomposition = UInt<UTerm, B1>

The number of bits in the bit decomposition of any element of this finite field. Read more
source§

fn bit_decomposition( &self ) -> GenericArray<bool, Self::NumberOfBitsInBitDecomposition>

Decompose the given field element into bits. Read more
source§

fn inverse(&self) -> Self

Compute the multiplicative inverse of self. Read more
source§

fn decompose<T: FiniteField + IsSubFieldOf<Self>>( &self ) -> GenericArray<T, DegreeModulo<T, Self>>

Decompose self into an array of T elements where T is a subfield of Self. Read more
source§

fn from_subfield<T: FiniteField + IsSubFieldOf<Self>>( arr: &GenericArray<T, DegreeModulo<T, Self>> ) -> Self

Create a field element from an array of subfield T elements. Read more
source§

impl FiniteRing for F2

source§

fn random<R: RngCore + ?Sized>(rng: &mut R) -> Self

This uniformly generates a field element either 0 or 1 for F2 type.

source§

fn random_nonzero<R: RngCore + ?Sized>(_rng: &mut R) -> Self

Generate a random non-zero element.
source§

const ZERO: Self = _

The additive identity element.
source§

const ONE: Self = _

The multiplicative identity element.
source§

fn from_uniform_bytes(x: &[u8; 16]) -> Self

Construct an element from the given uniformly chosen random bytes.
source§

fn pow(&self, n: u128) -> Self

Compute self to the power of n. Read more
source§

fn pow_bounded(&self, n: u128, bound: u16) -> Self

Compute self to the power of n, where n is guaranteed to be <= 2^bound. Read more
source§

fn pow_var_time(&self, n: u128) -> Self

Compute self to the power of n, in non-constant time.
source§

impl From<F2> for F128b

source§

fn from(x: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for F40b

source§

fn from(pf: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for F45b

source§

fn from(pf: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for F56b

source§

fn from(pf: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for F63b

source§

fn from(pf: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for F64b

source§

fn from(pf: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for bool

source§

fn from(x: F2) -> Self

Converts to this type from the input type.
source§

impl From<F2> for u8

This returns a canonical/reduced form of the field element.

source§

fn from(x: F2) -> Self

Converts to this type from the input type.
source§

impl From<bool> for F2

source§

fn from(x: bool) -> Self

Converts to this type from the input type.
source§

impl Hash for F2

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl IsSubFieldOf<F128b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F128b) -> GenericArray<Self, Self::DegreeModulo>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F128b

Homomorphically lift an array of Self into an FE.
source§

impl IsSubFieldOf<F40b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>, B0>, B0>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F40b) -> GenericArray<Self, U40>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F40b

Homomorphically lift an array of Self into an FE.
source§

impl IsSubFieldOf<F45b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B1>, B0>, B1>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F45b) -> GenericArray<Self, U45>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F45b

Homomorphically lift an array of Self into an FE.
source§

impl IsSubFieldOf<F56b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B0>, B0>, B0>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F56b) -> GenericArray<Self, U56>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F56b

Homomorphically lift an array of Self into an FE.
source§

impl IsSubFieldOf<F63b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F63b) -> GenericArray<Self, U63>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F63b

Homomorphically lift an array of Self into an FE.
source§

impl IsSubFieldOf<F64b> for F2

§

type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>

The value $n$ from above.
source§

fn decompose_superfield(fe: &F64b) -> GenericArray<Self, Self::DegreeModulo>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F64b

Homomorphically lift an array of Self into an FE.
source§

impl<'a> Mul<&'a F2> for F2

§

type Output = F2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a F2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<F128b> for F2

§

type Output = F128b

The resulting type after applying the * operator.
source§

fn mul(self, x: F128b) -> F128b

Performs the * operation. Read more
source§

impl<'a> Mul<F2> for &'a F2

§

type Output = F2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: F2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<F40b> for F2

§

type Output = F40b

The resulting type after applying the * operator.
source§

fn mul(self, x: F40b) -> F40b

Performs the * operation. Read more
source§

impl Mul<F45b> for F2

§

type Output = F45b

The resulting type after applying the * operator.
source§

fn mul(self, x: F45b) -> F45b

Performs the * operation. Read more
source§

impl Mul<F56b> for F2

§

type Output = F56b

The resulting type after applying the * operator.
source§

fn mul(self, x: F56b) -> F56b

Performs the * operation. Read more
source§

impl Mul<F63b> for F2

§

type Output = F63b

The resulting type after applying the * operator.
source§

fn mul(self, x: F63b) -> F63b

Performs the * operation. Read more
source§

impl Mul<F64b> for F2

§

type Output = F64b

The resulting type after applying the * operator.
source§

fn mul(self, x: F64b) -> F64b

Performs the * operation. Read more
source§

impl<'a> Mul for &'a F2

§

type Output = F2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'a F2) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for F2

§

type Output = F2

The resulting type after applying the * operator.
source§

fn mul(self, rhs: F2) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<&F2> for F2

source§

fn mul_assign(&mut self, rhs: &F2)

Performs the *= operation. Read more
source§

impl MulAssign for F2

source§

fn mul_assign(&mut self, rhs: F2)

Performs the *= operation. Read more
source§

impl Neg for F2

§

type Output = F2

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl One for F2

source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

impl PartialEq for F2

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Product for F2

source§

fn product<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by multiplying the items.
source§

impl Serialize for F2

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> Sub<&'a F2> for F2

§

type Output = F2

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'a F2) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub<F2> for &'a F2

§

type Output = F2

The resulting type after applying the - operator.
source§

fn sub(self, rhs: F2) -> Self::Output

Performs the - operation. Read more
source§

impl<'a> Sub for &'a F2

§

type Output = F2

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'a F2) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for F2

§

type Output = F2

The resulting type after applying the - operator.
source§

fn sub(self, rhs: F2) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<&F2> for F2

source§

fn sub_assign(&mut self, rhs: &F2)

Performs the -= operation. Read more
source§

impl SubAssign for F2

source§

fn sub_assign(&mut self, rhs: F2)

Performs the -= operation. Read more
source§

impl Sum for F2

source§

fn sum<I: Iterator<Item = Self>>(iter: I) -> Self

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl TryFrom<u128> for F2

§

type Error = BiggerThanModulus

The type returned in the event of a conversion error.
source§

fn try_from(value: u128) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl TryFrom<u8> for F2

§

type Error = BiggerThanModulus

The type returned in the event of a conversion error.
source§

fn try_from(value: u8) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Zero for F2

source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl Zeroable for F2

§

fn zeroed() -> Self

source§

impl Copy for F2

source§

impl Eq for F2

source§

impl IsSubRingOf<F128b> for F2

source§

impl IsSubRingOf<F40b> for F2

source§

impl IsSubRingOf<F45b> for F2

source§

impl IsSubRingOf<F56b> for F2

source§

impl IsSubRingOf<F63b> for F2

source§

impl IsSubRingOf<F64b> for F2

source§

impl PrimeFiniteField for F2

Auto Trait Implementations§

§

impl Freeze for F2

§

impl RefUnwindSafe for F2

§

impl Send for F2

§

impl Sync for F2

§

impl Unpin for F2

§

impl UnwindSafe for F2

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<FE> IsSubFieldOf<FE> for FE
where FE: FiniteField,

§

type DegreeModulo = UInt<UTerm, B1>

The value $n$ from above.
source§

fn decompose_superfield( fe: &FE ) -> GenericArray<FE, <FE as IsSubFieldOf<FE>>::DegreeModulo>

Turn FE into an array of Self, a subfield of FE.
source§

fn form_superfield( components: &GenericArray<FE, <FE as IsSubFieldOf<FE>>::DegreeModulo> ) -> FE

Homomorphically lift an array of Self into an FE.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<R> IsSubRingOf<R> for R
where R: FiniteRing,