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
We hide fields largely so that only comparing the compressed forms works.
impl PartialEq for RistrettoBoth
We hide fields largely so that only comparing the compressed forms works.