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 AddAssign<&F2> for F2
impl AddAssign<&F2> for F2
source§fn add_assign(&mut self, rhs: &F2)
fn add_assign(&mut self, rhs: &F2)
Performs the
+=
operation. Read moresource§impl AddAssign for F2
impl AddAssign for F2
source§fn add_assign(&mut self, rhs: F2)
fn add_assign(&mut self, rhs: F2)
Performs the
+=
operation. Read moresource§impl CanonicalSerialize for F2
impl CanonicalSerialize for F2
source§fn to_bytes(&self) -> GenericArray<u8, Self::ByteReprLen>
fn to_bytes(&self) -> GenericArray<u8, Self::ByteReprLen>
Return the canonical byte representation (byte representation of the reduced field element).
§type Serializer = F2BitSerializer
type Serializer = F2BitSerializer
A way to serialize field elements of this type. Read more
§type Deserializer = F2BitDeserializer
type Deserializer = F2BitDeserializer
A way to deserialize field elements of this type. Read more
§type ByteReprLen = UInt<UTerm, B1>
type ByteReprLen = UInt<UTerm, B1>
The number of bytes in the byte representation for this element.
§type FromBytesError = BiggerThanModulus
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>
fn from_bytes( buf: &GenericArray<u8, Self::ByteReprLen> ) -> Result<Self, BiggerThanModulus>
Deserialize an element from a byte array. Read more
source§impl ConditionallySelectable for F2
impl ConditionallySelectable for F2
source§impl ConstantTimeEq for F2
impl ConstantTimeEq for F2
source§impl<'de> Deserialize<'de> for F2
impl<'de> Deserialize<'de> for F2
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
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
impl Distribution<F2> for Standard
source§impl<'a> DivAssign<&'a F2> for F2
impl<'a> DivAssign<&'a F2> for F2
source§fn div_assign(&mut self, rhs: &Self)
fn div_assign(&mut self, rhs: &Self)
Performs the
/=
operation. Read moresource§impl DivAssign for F2
impl DivAssign for F2
source§fn div_assign(&mut self, rhs: F2)
fn div_assign(&mut self, rhs: F2)
Performs the
/=
operation. Read moresource§impl FiniteField for F2
impl FiniteField for F2
§type PrimeField = F2
type PrimeField = F2
The prime-order subfield of the finite field.
source§fn polynomial_modulus() -> Polynomial<Self::PrimeField>
fn polynomial_modulus() -> Polynomial<Self::PrimeField>
Multiplication over field elements should be reduced over this polynomial.
§type NumberOfBitsInBitDecomposition = UInt<UTerm, B1>
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>
fn bit_decomposition( &self ) -> GenericArray<bool, Self::NumberOfBitsInBitDecomposition>
Decompose the given field element into bits. Read more
source§fn decompose<T: FiniteField + IsSubFieldOf<Self>>(
&self
) -> GenericArray<T, DegreeModulo<T, Self>>
fn decompose<T: FiniteField + IsSubFieldOf<Self>>( &self ) -> GenericArray<T, DegreeModulo<T, Self>>
source§fn from_subfield<T: FiniteField + IsSubFieldOf<Self>>(
arr: &GenericArray<T, DegreeModulo<T, Self>>
) -> Self
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 moresource§impl FiniteRing for F2
impl FiniteRing for F2
source§fn random<R: RngCore + ?Sized>(rng: &mut R) -> Self
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
fn random_nonzero<R: RngCore + ?Sized>(_rng: &mut R) -> Self
Generate a random non-zero element.
source§fn from_uniform_bytes(x: &[u8; 16]) -> Self
fn from_uniform_bytes(x: &[u8; 16]) -> Self
Construct an element from the given uniformly chosen random bytes.
source§fn pow_bounded(&self, n: u128, bound: u16) -> Self
fn pow_bounded(&self, n: u128, bound: u16) -> Self
source§fn pow_var_time(&self, n: u128) -> Self
fn pow_var_time(&self, n: u128) -> Self
Compute
self
to the power of n
, in non-constant time.source§impl IsSubFieldOf<F128b> for F2
impl IsSubFieldOf<F128b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>, B0>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F128b
Homomorphically lift an array of
Self
into an FE
.source§impl IsSubFieldOf<F40b> for F2
impl IsSubFieldOf<F40b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B0>, B0>, B0>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F40b
Homomorphically lift an array of
Self
into an FE
.source§impl IsSubFieldOf<F45b> for F2
impl IsSubFieldOf<F45b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B1>, B1>, B0>, B1>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F45b
Homomorphically lift an array of
Self
into an FE
.source§impl IsSubFieldOf<F56b> for F2
impl IsSubFieldOf<F56b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B0>, B0>, B0>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F56b
Homomorphically lift an array of
Self
into an FE
.source§impl IsSubFieldOf<F63b> for F2
impl IsSubFieldOf<F63b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B1>, B1>, B1>, B1>, B1>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F63b
Homomorphically lift an array of
Self
into an FE
.source§impl IsSubFieldOf<F64b> for F2
impl IsSubFieldOf<F64b> for F2
§type DegreeModulo = UInt<UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>, B0>
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>
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
fn form_superfield(components: &GenericArray<Self, Self::DegreeModulo>) -> F64b
Homomorphically lift an array of
Self
into an FE
.source§impl MulAssign<&F2> for F2
impl MulAssign<&F2> for F2
source§fn mul_assign(&mut self, rhs: &F2)
fn mul_assign(&mut self, rhs: &F2)
Performs the
*=
operation. Read moresource§impl MulAssign for F2
impl MulAssign for F2
source§fn mul_assign(&mut self, rhs: F2)
fn mul_assign(&mut self, rhs: F2)
Performs the
*=
operation. Read moresource§impl PartialEq for F2
impl PartialEq for F2
source§impl SubAssign<&F2> for F2
impl SubAssign<&F2> for F2
source§fn sub_assign(&mut self, rhs: &F2)
fn sub_assign(&mut self, rhs: &F2)
Performs the
-=
operation. Read moresource§impl SubAssign for F2
impl SubAssign for F2
source§fn sub_assign(&mut self, rhs: F2)
fn sub_assign(&mut self, rhs: F2)
Performs the
-=
operation. Read moreimpl Copy for F2
impl Eq for F2
impl IsSubRingOf<F128b> for F2
impl IsSubRingOf<F40b> for F2
impl IsSubRingOf<F45b> for F2
impl IsSubRingOf<F56b> for F2
impl IsSubRingOf<F63b> for F2
impl IsSubRingOf<F64b> for F2
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<FE> IsSubFieldOf<FE> for FEwhere
FE: FiniteField,
impl<FE> IsSubFieldOf<FE> for FEwhere
FE: FiniteField,
§type DegreeModulo = UInt<UTerm, B1>
type DegreeModulo = UInt<UTerm, B1>
The value $
n
$ from above.source§fn decompose_superfield(
fe: &FE
) -> GenericArray<FE, <FE as IsSubFieldOf<FE>>::DegreeModulo>
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
fn form_superfield( components: &GenericArray<FE, <FE as IsSubFieldOf<FE>>::DegreeModulo> ) -> FE
Homomorphically lift an array of
Self
into an FE
.