File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ fn bitcoin_message_hash(message: &str) -> [u8; 32] {
1818
1919 // Double SHA256
2020 let first_hash = Sha256 :: digest ( & data) ;
21- let second_hash = Sha256 :: digest ( & first_hash) ;
21+ let second_hash = Sha256 :: digest ( first_hash) ;
2222
2323 let mut result = [ 0u8 ; 32 ] ;
2424 result. copy_from_slice ( & second_hash) ;
@@ -104,9 +104,9 @@ pub fn verify_bitcoin_message(
104104
105105 // Extract recovery id from header
106106 // Header values: 27-30 uncompressed, 31-34 compressed
107- let recovery_id = if header >= 31 && header <= 34 {
107+ let recovery_id = if ( 31 ..= 34 ) . contains ( & header ) {
108108 header - 31
109- } else if header >= 27 && header <= 30 {
109+ } else if ( 27 ..= 30 ) . contains ( & header ) {
110110 header - 27
111111 } else {
112112 return Err ( WasmBip32Error :: new ( "Invalid signature header" ) ) ;
You can’t perform that action at this time.
0 commit comments