mirror of
https://github.com/logos-blockchain/sponges.git
synced 2026-07-30 02:23:31 +00:00
ascon: use chunks_exact_mut for encoding permutation output (#48)
This commit is contained in:
parent
17519f46c6
commit
dc103866d4
@ -158,7 +158,9 @@ fn permutation(s: &mut [u8], start: usize, rounds: usize) {
|
||||
x[4] ^= x[4].rotate_right(7) ^ x[4].rotate_right(41);
|
||||
}
|
||||
|
||||
for (i, &b) in x.iter().enumerate() {
|
||||
s[(i * 8)..((i + 1) * 8)].copy_from_slice(&b.to_be_bytes())
|
||||
}
|
||||
x.into_iter()
|
||||
.map(u64::to_be_bytes)
|
||||
// TODO: replace with `array_chunks_mut` on stabilization
|
||||
.zip(s.chunks_exact_mut(8))
|
||||
.for_each(|(inp, out)| out.copy_from_slice(&inp))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user