Struct secp256k1::ecdh::SharedSecret [−][src]
pub struct SharedSecret { /* fields omitted */ }
Expand description
A tag used for recovering the public key from a compact signature
Implementations
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,
pub fn new_with_hash<F>(
point: &PublicKey,
scalar: &SecretKey,
hash_function: F
) -> SharedSecret where
F: FnMut([u8; 32], [u8; 32]) -> SharedSecret,
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()
});