Trait secp256kfun::hash::HashInto[][src]

pub trait HashInto {
    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};
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

Asks the item to convert itself to bytes and add itself to hash.

Implementations on Foreign Types

Implementors