[−][src]Struct secp256k1::curve::Field
Field element for secp256k1.
Methods
impl Field
[src]
impl Field
pub fn new(
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Self
[src]
pub fn new(
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Self
pub fn from_int(a: u32) -> Field
[src]
pub fn from_int(a: u32) -> Field
pub fn normalize(&mut self)
[src]
pub fn normalize(&mut self)
Normalize a field element.
pub fn normalize_weak(&mut self)
[src]
pub fn normalize_weak(&mut self)
Weakly normalize a field element: reduce it magnitude to 1, but don't fully normalize.
pub fn normalize_var(&mut self)
[src]
pub fn normalize_var(&mut self)
Normalize a field element, without constant-time guarantee.
pub fn normalizes_to_zero(&self) -> bool
[src]
pub fn normalizes_to_zero(&self) -> bool
Verify whether a field element represents zero i.e. would normalize to a zero value. The field implementation may optionally normalize the input, but this should not be relied upon.
pub fn normalizes_to_zero_var(&self) -> bool
[src]
pub fn normalizes_to_zero_var(&self) -> bool
Verify whether a field element represents zero i.e. would normalize to a zero value. The field implementation may optionally normalize the input, but this should not be relied upon.
pub fn set_int(&mut self, a: u32)
[src]
pub fn set_int(&mut self, a: u32)
Set a field element equal to a small integer. Resulting field element is normalized.
pub fn is_zero(&self) -> bool
[src]
pub fn is_zero(&self) -> bool
Verify whether a field element is zero. Requires the input to be normalized.
pub fn is_odd(&self) -> bool
[src]
pub fn is_odd(&self) -> bool
Check the "oddness" of a field element. Requires the input to be normalized.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Sets a field element equal to zero, initializing all fields.
#[must_use]
pub fn set_b32(&mut self, a: &[u8; 32]) -> bool
[src]
#[must_use]
pub fn set_b32(&mut self, a: &[u8; 32]) -> bool
Set a field element equal to 32-byte big endian value. If successful, the resulting field element is normalized.
pub fn fill_b32(&self, r: &mut [u8; 32])
[src]
pub fn fill_b32(&self, r: &mut [u8; 32])
pub fn b32(&self) -> [u8; 32]
[src]
pub fn b32(&self) -> [u8; 32]
Convert a field element to a 32-byte big endian value. Requires the input to be normalized.
pub fn neg_in_place(&mut self, other: &Field, m: u32)
[src]
pub fn neg_in_place(&mut self, other: &Field, m: u32)
Set a field element equal to the additive inverse of another. Takes a maximum magnitude of the input as an argument. The magnitude of the output is one higher.
pub fn neg(&self, m: u32) -> Field
[src]
pub fn neg(&self, m: u32) -> Field
pub fn mul_int(&mut self, a: u32)
[src]
pub fn mul_int(&mut self, a: u32)
Multiplies the passed field element with a small integer constant. Multiplies the magnitude by that small integer.
pub fn cmp_var(&self, other: &Field) -> Ordering
[src]
pub fn cmp_var(&self, other: &Field) -> Ordering
Compare two field elements. Requires both inputs to be normalized.
pub fn eq_var(&self, other: &Field) -> bool
[src]
pub fn eq_var(&self, other: &Field) -> bool
pub fn mul_in_place(&mut self, a: &Field, b: &Field)
[src]
pub fn mul_in_place(&mut self, a: &Field, b: &Field)
Sets a field element to be the product of two others. Requires the inputs' magnitudes to be at most 8. The output magnitude is 1 (but not guaranteed to be normalized).
pub fn sqr_in_place(&mut self, a: &Field)
[src]
pub fn sqr_in_place(&mut self, a: &Field)
Sets a field element to be the square of another. Requires the input's magnitude to be at most 8. The output magnitude is 1 (but not guaranteed to be normalized).
pub fn sqr(&self) -> Field
[src]
pub fn sqr(&self) -> Field
pub fn sqrt(&self) -> (Field, bool)
[src]
pub fn sqrt(&self) -> (Field, bool)
If a has a square root, it is computed in r and 1 is returned. If a does not have a square root, the root of its negation is computed and 0 is returned. The input's magnitude can be at most 8. The output magnitude is 1 (but not guaranteed to be normalized). The result in r will always be a square itself.
pub fn inv(&self) -> Field
[src]
pub fn inv(&self) -> Field
Sets a field element to be the (modular) inverse of another. Requires the input's magnitude to be at most 8. The output magnitude is 1 (but not guaranteed to be normalized).
pub fn inv_var(&self) -> Field
[src]
pub fn inv_var(&self) -> Field
Potentially faster version of secp256k1_fe_inv, without constant-time guarantee.
pub fn is_quad_var(&self) -> bool
[src]
pub fn is_quad_var(&self) -> bool
Checks whether a field element is a quadratic residue.
pub fn cmov(&mut self, other: &Field, flag: bool)
[src]
pub fn cmov(&mut self, other: &Field, flag: bool)
If flag is true, set *r equal to *a; otherwise leave it. Constant-time.
Trait Implementations
impl PartialEq<Field> for Field
[src]
impl PartialEq<Field> for Field
fn eq(&self, other: &Field) -> bool
[src]
fn eq(&self, other: &Field) -> bool
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Field
[src]
impl Eq for Field
impl Ord for Field
[src]
impl Ord for Field
fn cmp(&self, other: &Field) -> Ordering
[src]
fn cmp(&self, other: &Field) -> Ordering
fn max(self, other: Self) -> Self
1.21.0[src]
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
impl PartialOrd<Field> for Field
[src]
impl PartialOrd<Field> for Field
fn partial_cmp(&self, other: &Field) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Field) -> Option<Ordering>
#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
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
#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn gt(&self, other: &Rhs) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ge(&self, other: &Rhs) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Field
[src]
impl Debug for Field
impl Add<Field> for Field
[src]
impl Add<Field> for Field
type Output = Field
The resulting type after applying the +
operator.
fn add(self, other: Field) -> Field
[src]
fn add(self, other: Field) -> Field
impl<'a, 'b> Add<&'a Field> for &'b Field
[src]
impl<'a, 'b> Add<&'a Field> for &'b Field
type Output = Field
The resulting type after applying the +
operator.
fn add(self, other: &'a Field) -> Field
[src]
fn add(self, other: &'a Field) -> Field
impl Mul<Field> for Field
[src]
impl Mul<Field> for Field
type Output = Field
The resulting type after applying the *
operator.
fn mul(self, other: Field) -> Field
[src]
fn mul(self, other: Field) -> Field
impl<'a, 'b> Mul<&'a Field> for &'b Field
[src]
impl<'a, 'b> Mul<&'a Field> for &'b Field
type Output = Field
The resulting type after applying the *
operator.
fn mul(self, other: &'a Field) -> Field
[src]
fn mul(self, other: &'a Field) -> Field
impl<'a> AddAssign<&'a Field> for Field
[src]
impl<'a> AddAssign<&'a Field> for Field
fn add_assign(&mut self, other: &'a Field)
[src]
fn add_assign(&mut self, other: &'a Field)
impl AddAssign<Field> for Field
[src]
impl AddAssign<Field> for Field
fn add_assign(&mut self, other: Field)
[src]
fn add_assign(&mut self, other: Field)
impl<'a> MulAssign<&'a Field> for Field
[src]
impl<'a> MulAssign<&'a Field> for Field
fn mul_assign(&mut self, other: &'a Field)
[src]
fn mul_assign(&mut self, other: &'a Field)
impl MulAssign<Field> for Field
[src]
impl MulAssign<Field> for Field
fn mul_assign(&mut self, other: Field)
[src]
fn mul_assign(&mut self, other: Field)
impl Clone for Field
[src]
impl Clone for Field
fn clone(&self) -> Field
[src]
fn clone(&self) -> Field
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Field
[src]
impl Default for Field
Auto Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> Same for T
[src]
impl<T> Same for T
type Output = T
Should always be Self