Struct libsecp256k1::curve::Field [−][src]
pub struct Field { /* fields omitted */ }
Expand description
Field element for secp256k1.
Implementations
impl Field
[src]
impl Field
[src]pub const fn new_raw(
d9: u32,
d8: u32,
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Field
[src]
d9: u32,
d8: u32,
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Field
pub const fn new(
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Field
[src]
d7: u32,
d6: u32,
d5: u32,
d4: u32,
d3: u32,
d2: u32,
d1: u32,
d0: u32
) -> Field
pub fn from_int(a: u32) -> Field
[src]
pub fn normalize_weak(&mut self)
[src]
pub fn normalize_weak(&mut self)
[src]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)
[src]Normalize a field element, without constant-time guarantee.
pub fn normalizes_to_zero(&self) -> bool
[src]
pub 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.
pub fn normalizes_to_zero_var(&self) -> bool
[src]
pub 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.
pub fn set_int(&mut self, a: u32)
[src]
pub fn set_int(&mut self, a: u32)
[src]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
[src]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
[src]Check the “oddness” of a field element. Requires the input to be normalized.
#[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
[src]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 b32(&self) -> [u8; 32]
[src]
pub fn b32(&self) -> [u8; 32]
[src]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)
[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.
pub fn neg(&self, m: u32) -> Field
[src]
pub fn neg(&self, m: u32) -> Field
[src]Compute the additive inverse of this element. Takes the maximum expected magnitude of this element as an argument.
pub fn mul_int(&mut self, a: u32)
[src]
pub 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.
pub fn cmp_var(&self, other: &Field) -> Ordering
[src]
pub fn cmp_var(&self, other: &Field) -> Ordering
[src]Compare two field elements. Requires both inputs to be normalized.
pub fn eq_var(&self, other: &Field) -> bool
[src]
pub fn mul_in_place(&mut self, a: &Field, b: &Field)
[src]
pub 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).
pub fn sqr_in_place(&mut self, a: &Field)
[src]
pub 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).
pub fn sqr(&self) -> Field
[src]
pub fn sqrt(&self) -> (Field, bool)
[src]
pub 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.
pub fn inv(&self) -> Field
[src]
pub 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).
pub fn inv_var(&self) -> Field
[src]
pub fn inv_var(&self) -> Field
[src]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
[src]Checks whether a field element is a quadratic residue.
Trait Implementations
impl<'a> AddAssign<&'a Field> for Field
[src]
impl<'a> AddAssign<&'a Field> for Field
[src]pub fn add_assign(&mut self, other: &'a Field)
[src]
pub fn add_assign(&mut self, other: &'a Field)
[src]Performs the +=
operation. Read more
impl AddAssign<Field> for Field
[src]
impl AddAssign<Field> for Field
[src]pub fn add_assign(&mut self, other: Field)
[src]
pub fn add_assign(&mut self, other: Field)
[src]Performs the +=
operation. Read more
impl From<FieldStorage> for Field
[src]
impl From<FieldStorage> for Field
[src]pub fn from(a: FieldStorage) -> Field
[src]
pub fn from(a: FieldStorage) -> Field
[src]Performs the conversion.
impl Into<FieldStorage> for Field
[src]
impl Into<FieldStorage> for Field
[src]pub fn into(self) -> FieldStorage
[src]
pub fn into(self) -> FieldStorage
[src]Performs the conversion.
impl<'a> MulAssign<&'a Field> for Field
[src]
impl<'a> MulAssign<&'a Field> for Field
[src]pub fn mul_assign(&mut self, other: &'a Field)
[src]
pub fn mul_assign(&mut self, other: &'a Field)
[src]Performs the *=
operation. Read more
impl MulAssign<Field> for Field
[src]
impl MulAssign<Field> for Field
[src]pub fn mul_assign(&mut self, other: Field)
[src]
pub fn mul_assign(&mut self, other: Field)
[src]Performs the *=
operation. Read more
impl Ord for Field
[src]
impl Ord for Field
[src]impl PartialOrd<Field> for Field
[src]
impl PartialOrd<Field> for Field
[src]pub fn partial_cmp(&self, other: &Field) -> Option<Ordering>
[src]
pub fn partial_cmp(&self, other: &Field) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]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
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]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
impl Copy for Field
[src]
impl Eq for Field
[src]
Auto Trait Implementations
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,