[][src]Struct elgamal_curve25519::PublicKey

pub struct PublicKey(_);

PublicKey is an ElGamal public key. It's just a wrapper around CompressedRistretto. The key is computed as g^x, where g is the generator of the group G of order q, and x a PrivateKey.

Methods

impl PublicKey[src]

pub fn new(private: PrivateKey) -> PublicKey[src]

new creates a new PublicKey from a PrivateKey.

pub fn from_private(private: PrivateKey) -> PublicKey[src]

from_private creates a new PublicKey from a PrivateKey.

pub fn random() -> Result<PublicKey>[src]

random creates a new random PublicKey.

pub fn from_point(point: CompressedRistretto) -> PublicKey[src]

from_point creates a new PublicKey from a CompressedRistretto.

pub fn to_point(&self) -> CompressedRistretto[src]

to_point returns the inner CompressedRistretto of the PublicKey.

pub fn from_hash<D>(digest: D) -> PublicKey where
    D: Digest<OutputSize = U64> + Default
[src]

from_hash creates a new PublicKey from a 64 bytes hash.

pub fn from_bytes(buf: [u8; 32]) -> PublicKey[src]

from_bytes creates a new PublicKey from a slice of bytes.

pub fn to_bytes(&self) -> [u8; 32][src]

to_bytes returns the PublicKey as an array of bytes.

Trait Implementations

impl Eq for PublicKey[src]

impl PartialEq<PublicKey> for PublicKey[src]

impl Copy for PublicKey[src]

impl Clone for PublicKey[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PublicKey[src]

impl Add<PublicKey> for PublicKey[src]

type Output = Option<PublicKey>

The resulting type after applying the + operator.

impl Mul<PrivateKey> for PublicKey[src]

type Output = Option<PublicKey>

The resulting type after applying the * operator.

Auto Trait Implementations

impl Send for PublicKey

impl Sync for PublicKey

Blanket Implementations

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

type Owned = T

The resulting type after obtaining ownership.

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

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

type Output = T

Should always be Self