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

pub trait HashInto {
    fn hash_into(&self, hash: &mut impl Digest);
}

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

fn hash_into(&self, hash: &mut impl Digest)

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

Loading content...

Implementations on Foreign Types

impl HashInto for [u8][src]

impl HashInto for str[src]

Loading content...

Implementors

impl HashInto for Scalar[src]

impl<'a, S> HashInto for Slice<'a, S>[src]

impl<T: Normalized, S> HashInto for Point<T, S, NonZero>[src]

impl<Y> HashInto for XOnly<Y>[src]

Loading content...