Struct schnorrkel::points::RistrettoBoth [−][src]
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
impl RistrettoBoth
[src]
pub fn as_compressed(&self) -> &CompressedRistretto
[src]
Access the compressed Ristretto form
pub fn into_compressed(self) -> CompressedRistretto
[src]
Extract the compressed Ristretto form
pub fn as_point(&self) -> &RistrettoPoint
[src]
Access the point form
pub fn into_point(self) -> RistrettoPoint
[src]
Extract the point form
pub fn from_compressed(
compressed: CompressedRistretto
) -> SignatureResult<RistrettoBoth>
[src]
compressed: CompressedRistretto
) -> SignatureResult<RistrettoBoth>
Decompress into the RistrettoBoth
format that also retains the
compressed form.
pub fn from_point(point: RistrettoPoint) -> RistrettoBoth
[src]
Compress into the RistrettoBoth
format that also retains the
uncompressed form.
pub fn to_bytes(&self) -> [u8; 32]
[src]
Convert this public key to a byte array.
pub fn from_bytes(bytes: &[u8]) -> SignatureResult<RistrettoBoth>
[src]
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.
pub fn from_bytes_ser(
name: &'static str,
description: &'static str,
bytes: &[u8]
) -> SignatureResult<RistrettoBoth>
[src]
name: &'static str,
description: &'static str,
bytes: &[u8]
) -> SignatureResult<RistrettoBoth>
Variant of RistrettoBoth::from_bytes
that propogates more informative errors.
Trait Implementations
impl Clone for RistrettoBoth
[src]
fn clone(&self) -> RistrettoBoth
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for RistrettoBoth
[src]
impl Debug for RistrettoBoth
[src]
impl Default for RistrettoBoth
[src]
fn default() -> RistrettoBoth
[src]
impl Eq for RistrettoBoth
[src]
impl Hash for RistrettoBoth
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for RistrettoBoth
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<RistrettoBoth> for RistrettoBoth
[src]
We hide fields largely so that only compairing the compressed forms works.
impl PartialOrd<RistrettoBoth> for RistrettoBoth
[src]
fn partial_cmp(&self, other: &RistrettoBoth) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl StructuralEq for RistrettoBoth
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,