Struct unsafe_hacspec_examples::ec::p256::FieldElement
source · [−]pub struct FieldElement(_);
Implementations
sourceimpl FieldElement
impl FieldElement
pub fn from_canvas(x: FieldCanvas) -> FieldElement
pub fn into_canvas(self) -> FieldCanvas
pub fn max() -> FieldCanvas
pub fn declassify(self) -> BigInt
pub fn from_hex(s: &str) -> Self
pub fn from_be_bytes(v: &[u8]) -> Self
pub fn to_be_bytes(self) -> Vec<u8>
pub fn from_le_bytes(v: &[u8]) -> Self
pub fn to_le_bytes(self) -> Vec<u8>
pub fn from_literal(x: u128) -> Self
pub fn from_signed_literal(x: i128) -> Self
pub fn comp_eq(self, rhs: Self) -> Self
pub fn comp_ne(self, rhs: Self) -> Self
pub fn comp_gte(self, rhs: Self) -> Self
pub fn comp_gt(self, rhs: Self) -> Self
pub fn comp_lte(self, rhs: Self) -> Self
pub fn comp_lt(self, rhs: Self) -> Self
sourceimpl FieldElement
impl FieldElement
sourceimpl FieldElement
impl FieldElement
pub fn from_byte_seq_be<A: SeqTrait<U8>>(s: &A) -> FieldElement
pub fn from_public_byte_seq_be<A: SeqTrait<u8>>(s: A) -> FieldElement
pub fn to_byte_seq_be(self) -> Seq<U8>
pub fn to_public_byte_seq_be(self) -> Seq<u8>
pub fn from_byte_seq_le<A: SeqTrait<U8>>(s: A) -> FieldElement
pub fn from_public_byte_seq_le<A: SeqTrait<u8>>(s: A) -> FieldElement
pub fn to_byte_seq_le(self) -> Seq<U8>
pub fn to_public_byte_seq_le(self) -> Seq<u8>
pub fn from_secret_literal(x: U128) -> FieldElement
Trait Implementations
sourceimpl Add<FieldElement> for FieldElement
impl Add<FieldElement> for FieldElement
Warning: wraps on overflow.
type Output = FieldElement
type Output = FieldElement
The resulting type after applying the +
operator.
sourcefn add(self, rhs: FieldElement) -> FieldElement
fn add(self, rhs: FieldElement) -> FieldElement
Performs the +
operation. Read more
sourceimpl BitAnd<FieldElement> for FieldElement
impl BitAnd<FieldElement> for FieldElement
sourceimpl BitOr<FieldElement> for FieldElement
impl BitOr<FieldElement> for FieldElement
sourceimpl BitXor<FieldElement> for FieldElement
impl BitXor<FieldElement> for FieldElement
sourceimpl Clone for FieldElement
impl Clone for FieldElement
sourcefn clone(&self) -> FieldElement
fn clone(&self) -> FieldElement
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for FieldElement
impl Debug for FieldElement
sourceimpl Default for FieldElement
impl Default for FieldElement
sourcefn default() -> FieldElement
fn default() -> FieldElement
Returns the “default value” for a type. Read more
sourceimpl Display for FieldElement
impl Display for FieldElement
sourceimpl Div<FieldElement> for FieldElement
impl Div<FieldElement> for FieldElement
type Output = FieldElement
type Output = FieldElement
The resulting type after applying the /
operator.
sourcefn div(self, rhs: FieldElement) -> FieldElement
fn div(self, rhs: FieldElement) -> FieldElement
Performs the /
operation. Read more
sourceimpl From<FieldCanvas> for FieldElement
impl From<FieldCanvas> for FieldElement
sourcefn from(x: FieldCanvas) -> FieldElement
fn from(x: FieldCanvas) -> FieldElement
Converts to this type from the input type.
sourceimpl Integer for FieldElement
impl Integer for FieldElement
sourcefn set_bit(self, b: Self, i: usize) -> Self
fn set_bit(self, b: Self, i: usize) -> Self
Set bit i
of this integer to b
and return the result.
Bit b
has to be 0
or 1
.
sourcefn set(self, pos: usize, y: Self, yi: usize) -> Self
fn set(self, pos: usize, y: Self, yi: usize) -> Self
Set bit pos
of this integer to bit yi
of integer y
.
const NUM_BITS: usize = 256usize
fn ZERO() -> Self
fn ONE() -> Self
fn TWO() -> Self
sourcefn from_literal(val: u128) -> Self
fn from_literal(val: u128) -> Self
Get an integer with value val
.
sourcefn from_hex_string(s: &String) -> Self
fn from_hex_string(s: &String) -> Self
Read a hex string (starting with 0x) into an Integer
.
fn rotate_left(self, n: usize) -> Self
fn rotate_right(self, n: usize) -> Self
sourceimpl Into<FieldCanvas> for FieldElement
impl Into<FieldCanvas> for FieldElement
sourcefn into(self) -> FieldCanvas
fn into(self) -> FieldCanvas
Converts this type into the (usually inferred) input type.
sourceimpl LowerHex for FieldElement
impl LowerHex for FieldElement
sourceimpl ModNumeric for FieldElement
impl ModNumeric for FieldElement
sourcefn signed_modulo(self, n: Self) -> Self
fn signed_modulo(self, n: Self) -> Self
self % n
that always returns a positive integer
sourceimpl Mul<FieldElement> for FieldElement
impl Mul<FieldElement> for FieldElement
Warning: wraps on overflow.
type Output = FieldElement
type Output = FieldElement
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: FieldElement) -> FieldElement
fn mul(self, rhs: FieldElement) -> FieldElement
Performs the *
operation. Read more
sourceimpl Not for FieldElement
impl Not for FieldElement
sourceimpl Numeric for FieldElement
impl Numeric for FieldElement
sourcefn inv(self, n: Self) -> Self
fn inv(self, n: Self) -> Self
Invert self modulo n.
NOTE: n
is ignored and inversion is done with respect to
the modulus.
fn wrap_add(self, rhs: Self) -> Self
fn wrap_sub(self, rhs: Self) -> Self
fn wrap_mul(self, rhs: Self) -> Self
fn wrap_div(self, rhs: Self) -> Self
fn equal(self, other: Self) -> bool
fn greater_than(self, other: Self) -> bool
fn greater_than_or_equal(self, other: Self) -> bool
fn less_than(self, other: Self) -> bool
fn less_than_or_equal(self, other: Self) -> bool
fn not_equal_bm(self, other: Self) -> Self
fn equal_bm(self, other: Self) -> Self
fn greater_than_bm(self, other: Self) -> Self
fn greater_than_or_equal_bm(self, other: Self) -> Self
fn less_than_bm(self, other: Self) -> Self
fn less_than_or_equal_bm(self, other: Self) -> Self
sourceimpl Ord for FieldElement
impl Ord for FieldElement
sourceimpl PartialEq<FieldElement> for FieldElement
impl PartialEq<FieldElement> for FieldElement
sourceimpl PartialOrd<FieldElement> for FieldElement
impl PartialOrd<FieldElement> for FieldElement
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl Rem<FieldElement> for FieldElement
impl Rem<FieldElement> for FieldElement
Warning: panics on division by 0.
type Output = FieldElement
type Output = FieldElement
The resulting type after applying the %
operator.
sourcefn rem(self, rhs: FieldElement) -> FieldElement
fn rem(self, rhs: FieldElement) -> FieldElement
Performs the %
operation. Read more
sourceimpl Shl<usize> for FieldElement
impl Shl<usize> for FieldElement
sourceimpl Shr<usize> for FieldElement
impl Shr<usize> for FieldElement
sourceimpl Sub<FieldElement> for FieldElement
impl Sub<FieldElement> for FieldElement
Warning: wraps on underflow.
type Output = FieldElement
type Output = FieldElement
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: FieldElement) -> FieldElement
fn sub(self, rhs: FieldElement) -> FieldElement
Performs the -
operation. Read more
impl Copy for FieldElement
impl Eq for FieldElement
impl NumericCopy for FieldElement
impl UnsignedInteger for FieldElement
impl UnsignedIntegerCopy for FieldElement
Auto Trait Implementations
impl RefUnwindSafe for FieldElement
impl Send for FieldElement
impl Sync for FieldElement
impl Unpin for FieldElement
impl UnwindSafe for FieldElement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more