scsys_crypto/hash/h256/
impl_blake3.rs1use super::H256;
2use crate::Concat;
3
4use blake3::Hash;
5
6impl Concat<H256> for H256 {
7 type Output = H256;
8
9 fn concat(&self, rhs: H256) -> Self {
10 let mut curr = self.to_vec();
11 curr.append(&mut rhs.to_vec());
13
14 blake3::hash(&curr).into()
15 }
16}
17
18impl From<Hash> for H256 {
19 fn from(input: Hash) -> H256 {
20 let mut raw_hash: [u8; 32] = [0; 32];
21 raw_hash[0..32].copy_from_slice(input.as_bytes());
22 H256(raw_hash)
23 }
24}
25
26impl From<H256> for Hash {
27 fn from(input: H256) -> Hash {
28 Hash::from(input.0)
29 }
30}