1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::prelude::*;
use holo_hash::EntryHash;
use holo_hash::HeaderHash;
pub struct Hash256Bits([u8; 32]);
crate::secure_primitive!(Hash256Bits, 32);
pub struct Hash512Bits([u8; 64]);
crate::secure_primitive!(Hash512Bits, 64);
#[derive(Debug, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum HashInput {
Entry(Entry),
Header(Header),
Blake2B(#[serde(with = "serde_bytes")] Vec<u8>, u8),
Sha256(#[serde(with = "serde_bytes")] Vec<u8>),
Sha512(#[serde(with = "serde_bytes")] Vec<u8>),
Keccak256(#[serde(with = "serde_bytes")] Vec<u8>),
Sha3256(#[serde(with = "serde_bytes")] Vec<u8>),
}
#[derive(Debug, Serialize, Deserialize)]
#[non_exhaustive]
pub enum HashOutput {
Entry(EntryHash),
Header(HeaderHash),
Blake2B(#[serde(with = "serde_bytes")] Vec<u8>),
Sha256(Hash256Bits),
Sha512(Hash512Bits),
Keccak256(Hash256Bits),
Sha3256(Hash256Bits),
}