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

Access the compressed Ristretto form

Extract the compressed Ristretto form

Access the point form

Extract the point form

Decompress into the RistrettoBoth format that also retains the compressed form.

Compress into the RistrettoBoth format that also retains the uncompressed form.

Convert this public key to a byte array.

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.

Variant of RistrettoBoth::from_bytes that propogates more informative errors.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

We hide fields largely so that only compairing the compressed forms works.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.