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 propogates 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 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<RistrettoBoth> for RistrettoBoth
impl PartialEq<RistrettoBoth> for RistrettoBoth
We hide fields largely so that only compairing the compressed forms works.
source§impl PartialOrd<RistrettoBoth> for RistrettoBoth
impl PartialOrd<RistrettoBoth> 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 more