[][src]Struct secp256k1::ecdh::SharedSecret

pub struct SharedSecret { /* fields omitted */ }

A tag used for recovering the public key from a compact signature

Implementations

impl SharedSecret[src]

pub fn capacity(&self) -> usize[src]

Get the capacity of the underlying data buffer.

pub fn len(&self) -> usize[src]

Get the len of the used data.

impl SharedSecret[src]

pub fn new(point: &PublicKey, scalar: &SecretKey) -> SharedSecret[src]

Creates a new shared secret from a pubkey and secret key

pub fn new_with_hash<F>(
    point: &PublicKey,
    scalar: &SecretKey,
    hash_function: F
) -> SharedSecret where
    F: FnMut([u8; 32], [u8; 32]) -> SharedSecret
[src]

Creates a new shared secret from a pubkey and secret key with applied custom hash function The custom hash function must be in the form of fn(x: [u8;32], y: [u8;32]) -> SharedSecret SharedSecret can be easily created via the From impl from arrays.

Examples


let secret = SharedSecret::new_with_hash(&public_key, &secret_key, |x,y| {
    let hash: [u8; 32] = sha2(&x,&y);
    hash.into()
});

Trait Implementations

impl AsRef<[u8]> for SharedSecret[src]

impl Clone for SharedSecret[src]

impl Copy for SharedSecret[src]

impl Debug for SharedSecret

impl Deref for SharedSecret[src]

type Target = [u8]

The resulting type after dereferencing.

impl From<[u8; 128]> for SharedSecret[src]

impl From<[u8; 16]> for SharedSecret[src]

impl From<[u8; 20]> for SharedSecret[src]

impl From<[u8; 256]> for SharedSecret[src]

impl From<[u8; 28]> for SharedSecret[src]

impl From<[u8; 32]> for SharedSecret[src]

impl From<[u8; 48]> for SharedSecret[src]

impl From<[u8; 64]> for SharedSecret[src]

impl From<[u8; 96]> for SharedSecret[src]

impl PartialEq<SharedSecret> for SharedSecret[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> From<T> for T[src]

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

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>,