Struct secp256k1::curve::Field
[−]
[src]
pub struct Field { /* fields omitted */ }
Field element for secp256k1.
Methods
impl Field
[src]
fn new(
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Self
[src]
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Self
fn from_int(a: u32) -> Field
[src]
fn normalize(&mut self)
[src]
Normalize a field element.
fn normalize_weak(&mut self)
[src]
Weakly normalize a field element: reduce it magnitude to 1, but don't fully normalize.
fn normalize_var(&mut self)
[src]
Normalize a field element, without constant-time guarantee.
fn normalizes_to_zero(&self) -> bool
[src]
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.
fn normalizes_to_zero_var(&self) -> bool
[src]
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.
fn set_int(&mut self, a: u32)
[src]
Set a field element equal to a small integer. Resulting field element is normalized.
fn is_zero(&self) -> bool
[src]
Verify whether a field element is zero. Requires the input to be normalized.
fn is_odd(&self) -> bool
[src]
Check the "oddness" of a field element. Requires the input to be normalized.
fn clear(&mut self)
[src]
Sets a field element equal to zero, initializing all fields.
fn set_b32(&mut self, a: &[u8; 32]) -> bool
[src]
Set a field element equal to 32-byte big endian value. If successful, the resulting field element is normalized.
fn b32(&self) -> [u8; 32]
[src]
Convert a field element to a 32-byte big endian value. Requires the input to be normalized.
fn neg_in_place(&mut self, other: &Field, m: u32)
[src]
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.
fn neg(&self, m: u32) -> Field
[src]
fn mul_int(&mut self, a: u32)
[src]
Multiplies the passed field element with a small integer constant. Multiplies the magnitude by that small integer.
fn cmp_var(&self, other: &Field) -> Ordering
[src]
Compare two field elements. Requires both inputs to be normalized.
fn eq_var(&self, other: &Field) -> bool
[src]
fn mul_in_place(&mut self, a: &Field, b: &Field)
[src]
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).
fn sqr_in_place(&mut self, a: &Field)
[src]
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).
fn sqr(&self) -> Field
[src]
fn sqrt(&self) -> (Field, bool)
[src]
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.
fn inv(&self) -> Field
[src]
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).
fn inv_var(&self) -> Field
[src]
Potentially faster version of secp256k1_fe_inv, without constant-time guarantee.
fn is_quad_var(&self) -> bool
[src]
Checks whether a field element is a quadratic residue.
fn cmov(&mut self, other: &Field, flag: bool)
[src]
If flag is true, set *r equal to *a; otherwise leave it. Constant-time.
Trait Implementations
impl Debug for Field
[src]
impl Clone for Field
[src]
fn clone(&self) -> Field
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Default for Field
[src]
impl Add<Field> for Field
[src]
type Output = Field
The resulting type after applying the +
operator.
fn add(self, other: Field) -> Field
[src]
Performs the +
operation.
impl<'a, 'b> Add<&'a Field> for &'b Field
[src]
type Output = Field
The resulting type after applying the +
operator.
fn add(self, other: &'a Field) -> Field
[src]
Performs the +
operation.
impl<'a> AddAssign<&'a Field> for Field
[src]
fn add_assign(&mut self, other: &'a Field)
[src]
Performs the +=
operation.
impl AddAssign<Field> for Field
[src]
fn add_assign(&mut self, other: Field)
[src]
Performs the +=
operation.
impl Mul<Field> for Field
[src]
type Output = Field
The resulting type after applying the *
operator.
fn mul(self, other: Field) -> Field
[src]
Performs the *
operation.
impl<'a, 'b> Mul<&'a Field> for &'b Field
[src]
type Output = Field
The resulting type after applying the *
operator.
fn mul(self, other: &'a Field) -> Field
[src]
Performs the *
operation.
impl<'a> MulAssign<&'a Field> for Field
[src]
fn mul_assign(&mut self, other: &'a Field)
[src]
Performs the *=
operation.
impl MulAssign<Field> for Field
[src]
fn mul_assign(&mut self, other: Field)
[src]
Performs the *=
operation.
impl PartialEq for Field
[src]
fn eq(&self, other: &Field) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Eq for Field
[src]
impl Ord for Field
[src]
fn cmp(&self, other: &Field) -> Ordering
[src]
This method returns an Ordering
between self
and other
. Read more
fn max(self, other: Self) -> Self
1.22.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.22.0[src]
Compares and returns the minimum of two values. Read more
impl PartialOrd for Field
[src]
fn partial_cmp(&self, other: &Field) -> Option<Ordering>
[src]
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more