This repository was archived by the owner on Nov 30, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Expand file tree Collapse file tree 4 files changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ impl crate::HashEngine for HashEngine {
53
53
#[ cfg( not( fuzzing) ) ]
54
54
fn midstate ( & self ) -> [ u8 ; 20 ] {
55
55
let mut ret = [ 0 ; 20 ] ;
56
- for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
56
+ for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_exact_mut ( 4 ) ) {
57
57
ret_bytes. copy_from_slice ( & ( * val) . to_le_bytes ( ) ) ;
58
58
}
59
59
ret
@@ -269,7 +269,7 @@ impl HashEngine {
269
269
debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
270
270
271
271
let mut w = [ 0u32 ; 16 ] ;
272
- for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks ( 4 ) ) {
272
+ for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks_exact ( 4 ) ) {
273
273
* w_val = u32:: from_le_bytes ( buff_bytes. try_into ( ) . expect ( "4 byte slice" ) )
274
274
}
275
275
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl crate::HashEngine for HashEngine {
48
48
#[ cfg( not( fuzzing) ) ]
49
49
fn midstate ( & self ) -> [ u8 ; 20 ] {
50
50
let mut ret = [ 0 ; 20 ] ;
51
- for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
51
+ for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_exact_mut ( 4 ) ) {
52
52
ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) )
53
53
}
54
54
ret
@@ -157,7 +157,7 @@ impl HashEngine {
157
157
debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
158
158
159
159
let mut w = [ 0u32 ; 80 ] ;
160
- for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks ( 4 ) ) {
160
+ for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks_exact ( 4 ) ) {
161
161
* w_val = u32:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "4 bytes slice" ) )
162
162
}
163
163
for i in 16 ..80 {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl crate::HashEngine for HashEngine {
48
48
#[ cfg( not( fuzzing) ) ]
49
49
fn midstate ( & self ) -> Midstate {
50
50
let mut ret = [ 0 ; 32 ] ;
51
- for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 4 ) ) {
51
+ for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_exact_mut ( 4 ) ) {
52
52
ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) ) ;
53
53
}
54
54
Midstate ( ret)
@@ -259,7 +259,7 @@ impl HashEngine {
259
259
assert ! ( length % BLOCK_SIZE == 0 , "length is no multiple of the block size" ) ;
260
260
261
261
let mut ret = [ 0 ; 8 ] ;
262
- for ( ret_val, midstate_bytes) in ret. iter_mut ( ) . zip ( midstate[ ..] . chunks ( 4 ) ) {
262
+ for ( ret_val, midstate_bytes) in ret. iter_mut ( ) . zip ( midstate[ ..] . chunks_exact ( 4 ) ) {
263
263
* ret_val = u32:: from_be_bytes ( midstate_bytes. try_into ( ) . expect ( "4 byte slice" ) ) ;
264
264
}
265
265
@@ -275,7 +275,7 @@ impl HashEngine {
275
275
debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
276
276
277
277
let mut w = [ 0u32 ; 16 ] ;
278
- for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks ( 4 ) ) {
278
+ for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks_exact ( 4 ) ) {
279
279
* w_val = u32:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "4 byte slice" ) ) ;
280
280
}
281
281
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ impl crate::HashEngine for HashEngine {
56
56
#[ cfg( not( fuzzing) ) ]
57
57
fn midstate ( & self ) -> [ u8 ; 64 ] {
58
58
let mut ret = [ 0 ; 64 ] ;
59
- for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_mut ( 8 ) ) {
59
+ for ( val, ret_bytes) in self . h . iter ( ) . zip ( ret. chunks_exact_mut ( 8 ) ) {
60
60
ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) ) ;
61
61
}
62
62
ret
@@ -237,7 +237,7 @@ impl HashEngine {
237
237
debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
238
238
239
239
let mut w = [ 0u64 ; 16 ] ;
240
- for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks ( 8 ) ) {
240
+ for ( w_val, buff_bytes) in w. iter_mut ( ) . zip ( self . buffer . chunks_exact ( 8 ) ) {
241
241
* w_val = u64:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "8 byte slice" ) ) ;
242
242
}
243
243
You can’t perform that action at this time.
0 commit comments