library_blockchain/
hashable.rs

1use super::*;
2
3///sha-256 means generate 32 byte hash
4pub trait Hashable {
5    fn bytes(&self) -> Vec<u8>;
6
7    fn hash(&self) -> Hash {
8        crypto_hash::digest(crypto_hash::Algorithm::SHA256, &self.bytes())
9    }
10}