Trait secp256kfun::hash::HashInto
source · pub trait HashInto {
// Required method
fn hash_into(self, hash: &mut impl Digest);
}
Expand description
Anything that can be hashed.
The implementations of this trait decide how the type will be converted into bytes so that it can be included in the hash.
§Example
use digest::Digest;
use secp256kfun::hash::{HashAdd, HashInto};
#[derive(Clone, Copy)]
struct CryptoData([u8; 42]);
impl HashInto for CryptoData {
fn hash_into(self, hash: &mut impl digest::Digest) {
hash.update(&self.0[..])
}
}
let cryptodata = CryptoData([42u8; 42]);
let hash = sha2::Sha256::default().add(cryptodata).finalize();
Required Methods§
Object Safety§
This trait is not object safe.