ckb_fixed_hash_core/
std_hash.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::{H160, H256, H512, H520};

macro_rules! impl_std_hash_hash {
    ($name:ident, $bytes_size:expr) => {
        impl ::std::hash::Hash for $name {
            #[inline]
            fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
                state.write(&self.0[..])
            }
        }
    };
}

impl_std_hash_hash!(H160, 20);
impl_std_hash_hash!(H256, 32);
impl_std_hash_hash!(H512, 64);
impl_std_hash_hash!(H520, 65);