Trait sc_network::multiaddr::multihash::MultihashDigest [−]
pub trait MultihashDigest: 'static + TryFrom<u64> + Into<u64> + Send + Sync + Unpin + Copy + Eq + Debug { type AllocSize: Size; fn digest(&self, input: &[u8]) -> Multihash<Self::AllocSize>; fn multihash_from_digest<'a, S, D>(
digest: &'a D
) -> Multihash<Self::AllocSize>
where
Self: From<&'a D>,
S: Size,
D: Digest<S>; }
Expand description
Trait that implements hashing.
It is usually implemented by a custom code table enum that derives the Multihash
derive.
Associated Types
Required methods
Calculate the hash of some input data.
Example
// `Code` implements `MultihashDigest` use multihash::{Code, MultihashDigest}; let hash = Code::Sha3_256.digest(b"Hello world!"); println!("{:02x?}", hash);
Implementors
impl MultihashDigest for Code