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

pub struct SharedSecret { /* fields omitted */ }

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

Methods

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.

pub fn is_empty(&self) -> bool[src]

True if the underlying data buffer is empty.

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 From<[u8; 16]> for SharedSecret[src]

impl From<[u8; 20]> 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 From<[u8; 128]> for SharedSecret[src]

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

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

impl Clone for SharedSecret[src]

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

Performs copy-assignment from source. Read more

impl PartialEq<SharedSecret> for SharedSecret[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Copy for SharedSecret[src]

impl Debug for SharedSecret

impl Deref for SharedSecret[src]

type Target = [u8]

The resulting type after dereferencing.

Auto Trait Implementations

impl Unpin for SharedSecret

impl Sync for SharedSecret

impl Send for SharedSecret

impl UnwindSafe for SharedSecret

impl RefUnwindSafe for SharedSecret

Blanket Implementations

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

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