Struct ecdsa::RecoveryId
source · [−]pub struct RecoveryId(_);
Expand description
Recovery IDs, a.k.a. “recid”.
This is an integer value 0
, 1
, 2
, or 3
included along with a
signature which is used during the recovery process to select the correct
public key from the signature.
It consists of two bits of information:
- low bit (0/1): was the y-coordinate of the affine point resulting from the fixed-base multiplication 𝑘×𝑮 odd? This part of the algorithm functions similar to point decompression.
- hi bit (3/4): did the affine x-coordinate of 𝑘×𝑮 overflow the order of
the scalar field, requiring a reduction when computing
r
?
Implementations
sourceimpl RecoveryId
impl RecoveryId
sourcepub fn new(is_y_odd: bool, is_x_reduced: bool) -> Self
pub fn new(is_y_odd: bool, is_x_reduced: bool) -> Self
Create a new RecoveryId
from the following 1-bit arguments:
is_y_odd
: is the affine y-coordinate of 𝑘×𝑮 odd?is_x_reduced
: did the affine x-coordinate of 𝑘×𝑮 overflow the curve order?
sourcepub fn is_x_reduced(self) -> bool
pub fn is_x_reduced(self) -> bool
Did the affine x-coordinate of 𝑘×𝑮 overflow the curve order?
sourcepub fn to_byte(self) -> u8
pub fn to_byte(self) -> u8
Convert this RecoveryId
into a u8
.
Trait Implementations
sourceimpl Clone for RecoveryId
impl Clone for RecoveryId
sourcefn clone(&self) -> RecoveryId
fn clone(&self) -> RecoveryId
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 RecoveryId
impl Debug for RecoveryId
sourceimpl From<RecoveryId> for u8
impl From<RecoveryId> for u8
sourcefn from(id: RecoveryId) -> u8
fn from(id: RecoveryId) -> u8
Converts to this type from the input type.
sourceimpl Ord for RecoveryId
impl Ord for RecoveryId
sourceimpl PartialEq<RecoveryId> for RecoveryId
impl PartialEq<RecoveryId> for RecoveryId
sourcefn eq(&self, other: &RecoveryId) -> bool
fn eq(&self, other: &RecoveryId) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RecoveryId) -> bool
fn ne(&self, other: &RecoveryId) -> bool
This method tests for !=
.
sourceimpl PartialOrd<RecoveryId> for RecoveryId
impl PartialOrd<RecoveryId> for RecoveryId
sourcefn partial_cmp(&self, other: &RecoveryId) -> Option<Ordering>
fn partial_cmp(&self, other: &RecoveryId) -> 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 TryFrom<u8> for RecoveryId
impl TryFrom<u8> for RecoveryId
impl Copy for RecoveryId
impl Eq for RecoveryId
impl StructuralEq for RecoveryId
impl StructuralPartialEq for RecoveryId
Auto Trait Implementations
impl RefUnwindSafe for RecoveryId
impl Send for RecoveryId
impl Sync for RecoveryId
impl Unpin for RecoveryId
impl UnwindSafe for RecoveryId
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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more