File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,9 +250,14 @@ impl<Rate: BlockSizes> XofReader for CShakeReader<Rate> {
250250 } = self ;
251251
252252 buffer. read ( buf, |block| {
253- for ( src, dst) in state. iter ( ) . zip ( block. chunks_mut ( 8 ) ) {
254- dst. copy_from_slice ( & src. to_le_bytes ( ) [ ..dst. len ( ) ] ) ;
253+ let mut chunks = block. chunks_exact_mut ( 8 ) ;
254+ for ( src, dst) in state. iter ( ) . zip ( & mut chunks) {
255+ dst. copy_from_slice ( & src. to_le_bytes ( ) ) ;
255256 }
257+ assert ! (
258+ chunks. into_remainder( ) . is_empty( ) ,
259+ "rate is either 136 or 168" ,
260+ ) ;
256261 keccak. with_f1600 ( |f1600| f1600 ( state) ) ;
257262 } ) ;
258263 }
Original file line number Diff line number Diff line change @@ -191,9 +191,14 @@ impl<Rate: BlockSizes> XofReader for TurboShakeReader<Rate> {
191191 } = self ;
192192
193193 buffer. read ( buf, |block| {
194- for ( src, dst) in state. iter ( ) . zip ( block. chunks_mut ( 8 ) ) {
195- dst. copy_from_slice ( & src. to_le_bytes ( ) [ ..dst. len ( ) ] ) ;
194+ let mut chunks = block. chunks_exact_mut ( 8 ) ;
195+ for ( src, dst) in state. iter ( ) . zip ( & mut chunks) {
196+ dst. copy_from_slice ( & src. to_le_bytes ( ) ) ;
196197 }
198+ assert ! (
199+ chunks. into_remainder( ) . is_empty( ) ,
200+ "rate is either 136 or 168" ,
201+ ) ;
197202 keccak. with_p1600 :: < ROUNDS > ( |p1600| p1600 ( state) ) ;
198203 } ) ;
199204 }
You can’t perform that action at this time.
0 commit comments