Struct schnorrkel::points::RistrettoBoth
source · [−]pub struct RistrettoBoth { /* private fields */ }
Expand description
A RistrettoBoth
contains both an uncompressed RistrettoPoint
as well as the corresponding CompressedRistretto
. It provides
a convenient middle ground for protocols that both hash compressed
points to derive scalars for use with uncompressed points.
Implementations
sourceimpl RistrettoBoth
impl RistrettoBoth
sourcepub fn as_compressed(&self) -> &CompressedRistretto
pub fn as_compressed(&self) -> &CompressedRistretto
Access the compressed Ristretto form
sourcepub fn into_compressed(self) -> CompressedRistretto
pub fn into_compressed(self) -> CompressedRistretto
Extract the compressed Ristretto form
sourcepub fn as_point(&self) -> &RistrettoPoint
pub fn as_point(&self) -> &RistrettoPoint
Access the point form
sourcepub fn into_point(self) -> RistrettoPoint
pub fn into_point(self) -> RistrettoPoint
Extract the point form
sourcepub fn from_compressed(
compressed: CompressedRistretto
) -> SignatureResult<RistrettoBoth>
pub fn from_compressed(
compressed: CompressedRistretto
) -> SignatureResult<RistrettoBoth>
Decompress into the RistrettoBoth
format that also retains the
compressed form.
sourcepub fn from_point(point: RistrettoPoint) -> RistrettoBoth
pub fn from_point(point: RistrettoPoint) -> RistrettoBoth
Compress into the RistrettoBoth
format that also retains the
uncompressed form.
sourcepub fn from_bytes(bytes: &[u8]) -> SignatureResult<RistrettoBoth>
pub fn from_bytes(bytes: &[u8]) -> SignatureResult<RistrettoBoth>
Construct a RistrettoBoth
from a slice of bytes.
Example
use schnorrkel::points::RistrettoBoth;
use schnorrkel::PUBLIC_KEY_LENGTH;
use schnorrkel::SignatureError;
let public_key_bytes: [u8; PUBLIC_KEY_LENGTH] = [
215, 90, 152, 1, 130, 177, 10, 183, 213, 75, 254, 211, 201, 100, 7, 58,
14, 225, 114, 243, 218, 166, 35, 37, 175, 2, 26, 104, 247, 7, 81, 26];
let public_key = RistrettoBoth::from_bytes(&public_key_bytes)?;
Returns
A Result
whose okay value is an EdDSA RistrettoBoth
or whose error value
is an SignatureError
describing the error that occurred.
sourcepub fn from_bytes_ser(
name: &'static str,
description: &'static str,
bytes: &[u8]
) -> SignatureResult<RistrettoBoth>
pub fn from_bytes_ser(
name: &'static str,
description: &'static str,
bytes: &[u8]
) -> SignatureResult<RistrettoBoth>
Variant of RistrettoBoth::from_bytes
that propogates more informative errors.
Trait Implementations
sourceimpl Clone for RistrettoBoth
impl Clone for RistrettoBoth
sourcefn clone(&self) -> RistrettoBoth
fn clone(&self) -> RistrettoBoth
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 RistrettoBoth
impl Debug for RistrettoBoth
sourceimpl Default for RistrettoBoth
impl Default for RistrettoBoth
sourcefn default() -> RistrettoBoth
fn default() -> RistrettoBoth
Returns the “default value” for a type. Read more
sourceimpl<'d> Deserialize<'d> for RistrettoBoth
impl<'d> Deserialize<'d> for RistrettoBoth
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'d>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'d>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Hash for RistrettoBoth
impl Hash for RistrettoBoth
sourceimpl Ord for RistrettoBoth
impl Ord for RistrettoBoth
sourceimpl PartialEq<RistrettoBoth> for RistrettoBoth
impl PartialEq<RistrettoBoth> for RistrettoBoth
We hide fields largely so that only compairing the compressed forms works.
sourceimpl PartialOrd<RistrettoBoth> for RistrettoBoth
impl PartialOrd<RistrettoBoth> for RistrettoBoth
sourcefn partial_cmp(&self, other: &RistrettoBoth) -> Option<Ordering>
fn partial_cmp(&self, other: &RistrettoBoth) -> 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 Serialize for RistrettoBoth
impl Serialize for RistrettoBoth
impl Copy for RistrettoBoth
impl Eq for RistrettoBoth
impl StructuralEq for RistrettoBoth
Auto Trait Implementations
impl RefUnwindSafe for RistrettoBoth
impl Send for RistrettoBoth
impl Sync for RistrettoBoth
impl Unpin for RistrettoBoth
impl UnwindSafe for RistrettoBoth
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub 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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more