#[repr(transparent)]pub struct ExtElem(_);
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<ExtElem> for ExtElem
impl AddAssign<ExtElem> 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 Elem for ExtElem
impl Elem for ExtElem
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 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 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§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
source§impl MulAssign<ExtElem> for ExtElem
impl MulAssign<ExtElem> for ExtElem
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl SubAssign<ExtElem> for ExtElem
impl SubAssign<ExtElem> for ExtElem
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Simple subtraction case for Baby Bear ExtElem
impl Copy for ExtElem
impl Eq for ExtElem
impl Pod for ExtElem
impl StructuralEq for ExtElem
Auto Trait Implementations§
impl RefUnwindSafe for ExtElem
impl Send for ExtElem
impl Sync for ExtElem
impl Unpin for ExtElem
impl UnwindSafe for ExtElem
Blanket Implementations§
source§impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
impl<T> CheckedBitPattern for Twhere
T: AnyBitPattern,
§type Bits = T
type Bits = T
Self
must have the same layout as the specified Bits
except for
the possible invalid bit patterns being checked during
is_valid_bit_pattern
.source§fn is_valid_bit_pattern(_bits: &T) -> bool
fn is_valid_bit_pattern(_bits: &T) -> bool
If this function returns true, then it must be valid to reinterpret
bits
as &Self
.