etopay_sdk/types/
crypto.rs1use blake2::digest::{FixedOutput, FixedOutputReset, HashMarker, Output, OutputSizeUser, Reset, Update, consts::U32};
2
3pub struct Blake2b256(blake2::Blake2b<U32>);
5
6impl Blake2b256 {
7 pub fn new() -> Self {
9 Self(blake2::Blake2b::default())
10 }
11}
12
13impl Default for Blake2b256 {
14 fn default() -> Self {
15 Self::new()
16 }
17}
18
19impl OutputSizeUser for Blake2b256 {
20 type OutputSize = U32;
21}
22
23impl Reset for Blake2b256 {
24 fn reset(&mut self) {
25 self.0.reset();
26 }
27}
28
29impl FixedOutput for Blake2b256 {
30 fn finalize_into(self, out: &mut Output<Self>) {
31 self.0.finalize_into(out);
32 }
33}
34
35impl FixedOutputReset for Blake2b256 {
36 fn finalize_into_reset(&mut self, out: &mut Output<Self>) {
37 self.0.finalize_into_reset(out);
38 }
39}
40
41impl Update for Blake2b256 {
42 fn update(&mut self, data: &[u8]) {
43 self.0.update(data);
44 }
45}
46
47impl HashMarker for Blake2b256 {}