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 {
5353 #[ cfg( not( fuzzing) ) ]
5454 fn midstate ( & self ) -> [ u8 ; 20 ] {
5555 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 ) ) {
5757 ret_bytes. copy_from_slice ( & ( * val) . to_le_bytes ( ) ) ;
5858 }
5959 ret
@@ -269,7 +269,7 @@ impl HashEngine {
269269 debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
270270
271271 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 ) ) {
273273 * w_val = u32:: from_le_bytes ( buff_bytes. try_into ( ) . expect ( "4 byte slice" ) )
274274 }
275275
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl crate::HashEngine for HashEngine {
4848 #[ cfg( not( fuzzing) ) ]
4949 fn midstate ( & self ) -> [ u8 ; 20 ] {
5050 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 ) ) {
5252 ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) )
5353 }
5454 ret
@@ -157,7 +157,7 @@ impl HashEngine {
157157 debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
158158
159159 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 ) ) {
161161 * w_val = u32:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "4 bytes slice" ) )
162162 }
163163 for i in 16 ..80 {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ impl crate::HashEngine for HashEngine {
4848 #[ cfg( not( fuzzing) ) ]
4949 fn midstate ( & self ) -> Midstate {
5050 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 ) ) {
5252 ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) ) ;
5353 }
5454 Midstate ( ret)
@@ -259,7 +259,7 @@ impl HashEngine {
259259 assert ! ( length % BLOCK_SIZE == 0 , "length is no multiple of the block size" ) ;
260260
261261 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 ) ) {
263263 * ret_val = u32:: from_be_bytes ( midstate_bytes. try_into ( ) . expect ( "4 byte slice" ) ) ;
264264 }
265265
@@ -275,7 +275,7 @@ impl HashEngine {
275275 debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
276276
277277 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 ) ) {
279279 * w_val = u32:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "4 byte slice" ) ) ;
280280 }
281281
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ impl crate::HashEngine for HashEngine {
5656 #[ cfg( not( fuzzing) ) ]
5757 fn midstate ( & self ) -> [ u8 ; 64 ] {
5858 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 ) ) {
6060 ret_bytes. copy_from_slice ( & val. to_be_bytes ( ) ) ;
6161 }
6262 ret
@@ -237,7 +237,7 @@ impl HashEngine {
237237 debug_assert_eq ! ( self . buffer. len( ) , BLOCK_SIZE ) ;
238238
239239 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 ) ) {
241241 * w_val = u64:: from_be_bytes ( buff_bytes. try_into ( ) . expect ( "8 byte slice" ) ) ;
242242 }
243243
You can’t perform that action at this time.
0 commit comments