#[repr(transparent)]pub struct Gf256(pub u8);
Expand description
Represents the finite field GF(2^8) with 256 elements.
Tuple Fields§
§0: u8
Implementations§
source§impl Gf256
impl Gf256
sourcepub fn split_array<B: AsRef<[u8]>>(
threshold: usize,
limit: usize,
secret: B,
rng: impl RngCore + CryptoRng
) -> VsssResult<Vec<Vec<u8>>>
pub fn split_array<B: AsRef<[u8]>>( threshold: usize, limit: usize, secret: B, rng: impl RngCore + CryptoRng ) -> VsssResult<Vec<Vec<u8>>>
Split a byte array into shares.
sourcepub fn split_array_with_participant_generator<P: ParticipantNumberGenerator<Self>, B: AsRef<[u8]>>(
threshold: usize,
limit: usize,
secret: B,
rng: impl RngCore + CryptoRng,
participant_generator: P
) -> VsssResult<Vec<Vec<u8>>>
pub fn split_array_with_participant_generator<P: ParticipantNumberGenerator<Self>, B: AsRef<[u8]>>( threshold: usize, limit: usize, secret: B, rng: impl RngCore + CryptoRng, participant_generator: P ) -> VsssResult<Vec<Vec<u8>>>
Split a byte array into shares using the participant number generator.
sourcepub fn combine_array<B: AsRef<[Vec<u8>]>>(shares: B) -> VsssResult<Vec<u8>>
pub fn combine_array<B: AsRef<[Vec<u8>]>>(shares: B) -> VsssResult<Vec<u8>>
Combine shares into a byte array.
Trait Implementations§
source§impl AddAssign<&Gf256> for Gf256
impl AddAssign<&Gf256> for Gf256
source§fn add_assign(&mut self, rhs: &Gf256)
fn add_assign(&mut self, rhs: &Gf256)
Performs the
+=
operation. Read moresource§impl AddAssign for Gf256
impl AddAssign for Gf256
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl BitAndAssign<&Gf256> for Gf256
impl BitAndAssign<&Gf256> for Gf256
source§fn bitand_assign(&mut self, rhs: &Gf256)
fn bitand_assign(&mut self, rhs: &Gf256)
Performs the
&=
operation. Read moresource§impl BitAndAssign for Gf256
impl BitAndAssign for Gf256
source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&=
operation. Read moresource§impl BitOrAssign<&Gf256> for Gf256
impl BitOrAssign<&Gf256> for Gf256
source§fn bitor_assign(&mut self, rhs: &Gf256)
fn bitor_assign(&mut self, rhs: &Gf256)
Performs the
|=
operation. Read moresource§impl BitOrAssign for Gf256
impl BitOrAssign for Gf256
source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|=
operation. Read moresource§impl BitXorAssign<&Gf256> for Gf256
impl BitXorAssign<&Gf256> for Gf256
source§fn bitxor_assign(&mut self, rhs: &Gf256)
fn bitxor_assign(&mut self, rhs: &Gf256)
Performs the
^=
operation. Read moresource§impl BitXorAssign for Gf256
impl BitXorAssign for Gf256
source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
Performs the
^=
operation. Read moresource§impl ConditionallySelectable for Gf256
impl ConditionallySelectable for Gf256
source§impl ConstantTimeEq for Gf256
impl ConstantTimeEq for Gf256
source§impl DivAssign<&Gf256> for Gf256
impl DivAssign<&Gf256> for Gf256
source§fn div_assign(&mut self, rhs: &Gf256)
fn div_assign(&mut self, rhs: &Gf256)
Performs the
/=
operation. Read moresource§impl DivAssign for Gf256
impl DivAssign for Gf256
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moresource§impl Field for Gf256
impl Field for Gf256
source§fn random(rng: impl RngCore) -> Self
fn random(rng: impl RngCore) -> Self
Returns an element chosen uniformly at random using a user-provided RNG.
source§fn invert(&self) -> CtOption<Self>
fn invert(&self) -> CtOption<Self>
Computes the multiplicative inverse of this element,
failing if the element is zero.
source§fn is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
Returns true iff this element is zero. Read more
source§fn sqrt(&self) -> CtOption<Self>
fn sqrt(&self) -> CtOption<Self>
Returns the square root of the field element, if it is
quadratic residue. Read more
source§impl MulAssign<&Gf256> for Gf256
impl MulAssign<&Gf256> for Gf256
source§fn mul_assign(&mut self, rhs: &Gf256)
fn mul_assign(&mut self, rhs: &Gf256)
Performs the
*=
operation. Read moresource§impl MulAssign for Gf256
impl MulAssign for Gf256
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl Ord for Gf256
impl Ord for Gf256
source§impl PartialEq for Gf256
impl PartialEq for Gf256
source§impl PartialOrd for Gf256
impl PartialOrd for Gf256
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl PrimeField for Gf256
impl PrimeField for Gf256
§type Repr = [u8; 1]
type Repr = [u8; 1]
The prime field can be converted back and forth into this binary
representation.
source§fn from_repr(repr: Self::Repr) -> CtOption<Self>
fn from_repr(repr: Self::Repr) -> CtOption<Self>
Attempts to convert a byte representation of a field element into an element of
this prime field, failing if the input is not canonical (is not smaller than the
field’s modulus). Read more
source§fn to_repr(&self) -> Self::Repr
fn to_repr(&self) -> Self::Repr
Converts an element of the prime field into the standard byte representation for
this field. Read more
source§const MODULUS: &'static str = ""
const MODULUS: &'static str = ""
Modulus of the field written as a string for debugging purposes. Read more
source§const CAPACITY: u32 = 7u32
const CAPACITY: u32 = 7u32
How many bits of information can be reliably stored in the field element. Read more
source§const MULTIPLICATIVE_GENERATOR: Self = _
const MULTIPLICATIVE_GENERATOR: Self = _
A fixed multiplicative generator of
modulus - 1
order. This element must also be
a quadratic nonresidue. Read moresource§const ROOT_OF_UNITY: Self = _
const ROOT_OF_UNITY: Self = _
The
2^s
root of unity. Read moresource§const ROOT_OF_UNITY_INV: Self = _
const ROOT_OF_UNITY_INV: Self = _
Inverse of
Self::ROOT_OF_UNITY
.source§fn from_str_vartime(s: &str) -> Option<Self>
fn from_str_vartime(s: &str) -> Option<Self>
Interpret a string of numbers as a (congruent) prime field element.
Does not accept unnecessary leading zeroes or a blank string. Read more
source§impl SubAssign<&Gf256> for Gf256
impl SubAssign<&Gf256> for Gf256
source§fn sub_assign(&mut self, rhs: &Gf256)
fn sub_assign(&mut self, rhs: &Gf256)
Performs the
-=
operation. Read moresource§impl SubAssign for Gf256
impl SubAssign for Gf256
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl Copy for Gf256
impl Eq for Gf256
impl StructuralPartialEq for Gf256
Auto Trait Implementations§
impl Freeze for Gf256
impl RefUnwindSafe for Gf256
impl Send for Gf256
impl Sync for Gf256
impl Unpin for Gf256
impl UnwindSafe for Gf256
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