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§
source§impl 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 propagates more informative errors.
Trait Implementations§
source§impl Clone for RistrettoBoth
impl Clone for RistrettoBoth
source§fn clone(&self) -> RistrettoBoth
fn clone(&self) -> RistrettoBoth
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConstantTimeEq for RistrettoBoth
impl ConstantTimeEq for RistrettoBoth
source§impl Debug for RistrettoBoth
impl Debug for RistrettoBoth
source§impl Default for RistrettoBoth
impl Default for RistrettoBoth
source§fn default() -> RistrettoBoth
fn default() -> RistrettoBoth
source§impl Hash for RistrettoBoth
impl Hash for RistrettoBoth
source§impl Ord for RistrettoBoth
impl Ord for RistrettoBoth
source§impl PartialEq for RistrettoBoth
impl PartialEq for RistrettoBoth
We hide fields largely so that only comparing the compressed forms works.
source§impl PartialOrd for RistrettoBoth
impl PartialOrd for RistrettoBoth
source§fn partial_cmp(&self, other: &RistrettoBoth) -> Option<Ordering>
fn partial_cmp(&self, other: &RistrettoBoth) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for RistrettoBoth
impl Eq for RistrettoBoth
Auto Trait Implementations§
impl Freeze for RistrettoBoth
impl RefUnwindSafe for RistrettoBoth
impl Send for RistrettoBoth
impl Sync for RistrettoBoth
impl Unpin for RistrettoBoth
impl UnwindSafe for RistrettoBoth
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)