common_traits/hash.rs
1/// An generalization of [`core::hash::Hasher`] that doesn't force the output to
2/// be [`u64`]
3pub trait Hasher {
4 type Result;
5 fn finish(&self) -> Self::Result;
6 fn write(&mut self, bytes: &[u8]);
7}
8
9/// An hasher that has extra parameters in initalization
10pub trait SeedableHasher {
11 type Seed;
12 fn new(seed: Self::Seed) -> Self;
13}
14
15/// The analog of [`core::hash::Hash`] but that uses [`Hash`]
16pub trait Hash {
17 fn hash<H: Hasher>(&self, state: &mut H);
18}