File tree Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Expand file tree Collapse file tree 2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ serde_repr.workspace = true
15
15
chrono.workspace = true
16
16
uuid.workspace = true
17
17
log.workspace = true
18
- sha2.workspace = true
19
18
thiserror.workspace = true
20
19
bitcoin.workspace = true
21
20
bip39.workspace = true
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ pub mod date;
3
3
4
4
pub use crypto:: BcrKeys ;
5
5
6
- use sha2:: { Digest , Sha256 } ;
6
+ use bitcoin:: hashes:: sha256;
7
+ use bitcoin:: hashes:: Hash ;
7
8
use thiserror:: Error ;
8
9
use uuid:: Uuid ;
9
10
@@ -12,10 +13,8 @@ pub fn get_uuid_v4() -> Uuid {
12
13
}
13
14
14
15
pub fn sha256_hash ( bytes : & [ u8 ] ) -> String {
15
- let mut hasher = Sha256 :: new ( ) ;
16
- hasher. update ( bytes) ;
17
- let hash = hasher. finalize ( ) ;
18
- base58_encode ( & hash)
16
+ let hash = sha256:: Hash :: hash ( bytes) . to_byte_array ( ) ;
17
+ base58_encode ( hash. as_slice ( ) )
19
18
}
20
19
21
20
#[ derive( Debug , Error ) ]
You can’t perform that action at this time.
0 commit comments