File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/rust/bitbox02-rust/src Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ use alloc::vec::Vec;
21
21
/// This implementation accumulates the data to be hashed in heap, it does **not** hash in a
22
22
/// streaming fashion, even when using `update()`.
23
23
#[ derive( Default , Clone ) ]
24
- pub struct Sha512 ( Vec < u8 > ) ;
24
+ pub struct Sha512 {
25
+ message : Vec < u8 > ,
26
+ }
25
27
26
28
impl digest:: HashMarker for Sha512 { }
27
29
@@ -32,20 +34,20 @@ impl digest::OutputSizeUser for Sha512 {
32
34
impl digest:: FixedOutput for Sha512 {
33
35
fn finalize_into ( self , out : & mut digest:: Output < Self > ) {
34
36
// use digest::Digest;
35
- // out.copy_from_slice(&sha2::Sha512::digest(&self.0 ));
36
- out. copy_from_slice ( & bitbox02:: sha512 ( & self . 0 ) ) ;
37
+ // out.copy_from_slice(&sha2::Sha512::digest(&self.message ));
38
+ out. copy_from_slice ( & bitbox02:: sha512 ( & self . message ) ) ;
37
39
}
38
40
}
39
41
40
42
impl digest:: Update for Sha512 {
41
43
fn update ( & mut self , data : & [ u8 ] ) {
42
- self . 0 . extend ( data) ;
44
+ self . message . extend ( data) ;
43
45
}
44
46
}
45
47
46
48
impl digest:: Reset for Sha512 {
47
49
fn reset ( & mut self ) {
48
- self . 0 = vec ! [ ] ;
50
+ self . message = vec ! [ ] ;
49
51
}
50
52
}
51
53
You can’t perform that action at this time.
0 commit comments