pub struct ExtElem(/* private fields */);Expand description
Instances of ExtElem are elements of a finite field F_p^4. They are
represented as elements of F_p[X] / (X^4 + 11). This large
finite field (about 2^128 elements) is used when the security of
operations depends on the size of the field. The field extension ExtElem
has Elem as a subfield, so operations on elements of each are compatible.
The irreducible polynomial x^4 + 11 was chosen because 11 is
the simplest choice of BETA for x^4 + BETA that makes this polynomial
irreducible.
Implementations§
Trait Implementations§
Source§impl AddAssign for ExtElem
impl AddAssign for ExtElem
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Simple addition case for Baby Bear ExtElem
Source§impl AddAssign<Elem> for ExtElem
impl AddAssign<Elem> for ExtElem
Source§fn add_assign(&mut self, rhs: Elem)
fn add_assign(&mut self, rhs: Elem)
Promoting addition case for BabyBear Elem
Source§impl CheckedBitPattern for ExtElem
impl CheckedBitPattern for ExtElem
impl Copy for ExtElem
Source§impl Elem for ExtElem
impl Elem for ExtElem
Source§fn from_u64(val: u64) -> Self
fn from_u64(val: u64) -> Self
Convert from a u64 to a base field elem, then cast to the extension field.
Source§const INVALID: Self
const INVALID: Self
Invalid, a value that is not a member of the field. This
should only be used with the “is_valid” or “unwrap_or_zero”
methods.
Source§fn to_u32_words(&self) -> Vec<u32>
fn to_u32_words(&self) -> Vec<u32>
Represent a field element as a sequence of u32s
Source§fn from_u32_words(val: &[u32]) -> Self
fn from_u32_words(val: &[u32]) -> Self
Interpret a sequence of u32s as a field element
Source§fn is_valid(&self) -> bool
fn is_valid(&self) -> bool
Returns true if this element is not INVALID. Unlike most
methods, this may be called on an INVALID element.
Source§fn is_reduced(&self) -> bool
fn is_reduced(&self) -> bool
Returns true if this element is represented in reduced/normalized form.
Every element has exactly one reduced form. For a field of prime order
P, this typically means the underlying data is < P, and for an extension
field, this typically means every component is in reduced form.
Source§fn valid_or_zero(&self) -> Self
fn valid_or_zero(&self) -> Self
Returns 0 if this element is INVALID, else the value of this
element. Unlike most methods, this may be called on an
INVALID element.
Source§fn ensure_valid(&self) -> &Self
fn ensure_valid(&self) -> &Self
Returns this element, but checks to make sure it’s valid.
Source§fn ensure_reduced(&self) -> &Self
fn ensure_reduced(&self) -> &Self
Returns this element, but checks to make sure it’s in reduced form.
Source§fn as_u32_slice(elems: &[Self]) -> &[u32]
fn as_u32_slice(elems: &[Self]) -> &[u32]
Interprets a slice of these elements as u32s. These elements
may not be INVALID.
Source§fn as_u32_slice_unchecked(elems: &[Self]) -> &[u32]
fn as_u32_slice_unchecked(elems: &[Self]) -> &[u32]
Interprets a slice of these elements as u32s. These elements
may potentially be INVALID.
Source§fn from_u32_slice(u32s: &[u32]) -> &[Self]
fn from_u32_slice(u32s: &[u32]) -> &[Self]
Interprets a slice of u32s as a slice of these elements.
These elements may not be INVALID.
Source§fn try_from_u32_slice(u32s: &[u32]) -> Result<&[Self], CheckedCastError>
fn try_from_u32_slice(u32s: &[u32]) -> Result<&[Self], CheckedCastError>
Interprets a slice of u32s as a slice of these elements.
These elements may not be INVALID.
impl Eq for ExtElem
Source§impl ExtElem for ExtElem
impl ExtElem for ExtElem
Source§fn from_subfield(elem: &Elem) -> Self
fn from_subfield(elem: &Elem) -> Self
Interpret a base field element as an extension field element Read more
Source§fn from_subelems(elems: impl IntoIterator<Item = Self::SubElem>) -> Self
fn from_subelems(elems: impl IntoIterator<Item = Self::SubElem>) -> Self
Construct an extension field element Read more
Source§impl MulAssign for ExtElem
impl MulAssign for ExtElem
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl MulAssign<Elem> for ExtElem
impl MulAssign<Elem> for ExtElem
Source§fn mul_assign(&mut self, rhs: Elem)
fn mul_assign(&mut self, rhs: Elem)
Simple multiplication case by a Baby Bear Elem
impl NoUninit for ExtElem
Source§impl SubAssign for ExtElem
impl SubAssign for ExtElem
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Simple subtraction case for Baby Bear ExtElem
Auto Trait Implementations§
impl Freeze for ExtElem
impl RefUnwindSafe for ExtElem
impl Send for ExtElem
impl Sync for ExtElem
impl Unpin for ExtElem
impl UnsafeUnpin for ExtElem
impl UnwindSafe for ExtElem
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