[][src]Struct mohan::tools::RistrettoBoth

pub struct RistrettoBoth { /* fields omitted */ }

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.

Methods

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) -> Option<RistrettoBoth>[src]

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 point to a byte array.

pub fn as_bytes<'a>(&'a self) -> &'a [u8; 32][src]

Convert this point to a byte array.

pub fn from_bytes(bytes: &[u8]) -> Option<RistrettoBoth>[src]

Construct a RistrettoBoth from a slice of bytes.

Warning

The caller is responsible for ensuring that the bytes passed into this method actually represent a curve25519_dalek::ristretto::CompressedRistretto and that said compressed point is actually a point on the curve.

Example


use mohan::tools::RistrettoBoth;

let public_key_bytes: [u8; 32] = [
   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 RistrettoBoth or whose error value is an SignatureError describing the error that occurred.

Trait Implementations

impl Clone for RistrettoBoth[src]

impl Copy for RistrettoBoth[src]

impl Debug for RistrettoBoth[src]

impl Default for RistrettoBoth[src]

impl Eq for RistrettoBoth[src]

impl Hash for RistrettoBoth[src]

impl Ord for RistrettoBoth[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]

impl Readable for RistrettoBoth[src]

impl StructuralEq for RistrettoBoth[src]

impl Writeable for RistrettoBoth[src]

impl Zeroize for RistrettoBoth[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> Cast<U> for T where
    U: FromCast<T>, 

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FromBits<T> for T

impl<T> FromCast<T> for T

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> IntoBits<U> for T where
    U: FromBits<T>, 

impl<N> NodeTrait for N where
    N: Copy + Ord + Hash
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<Z> Zeroize for Z where
    Z: DefaultIsZeroes
[src]