Skip to content

Commit

Permalink
docs: minor padding comment update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Feb 14, 2024
1 parent 0acceaa commit 727ed8f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/hash/rescue/rpx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ impl Hasher for Rpx256 {
// `i` is not zero, then the chunks count wasn't enough to fill the state range, and an
// additional permutation must be performed.
let i = bytes.chunks(BINARY_CHUNK_SIZE).fold(0, |i, chunk| {
// we always pad `bytes` with a 1 followed by as many 0's to fill up `buf`.
// copy the chunk into the buffer
if i != num_field_elem - 1 {
buf[..BINARY_CHUNK_SIZE].copy_from_slice(chunk);
} else {
// on the last iteration, we pad `buf` with a 1 followed by as many 0's as are
// needed to fill it
buf.fill(0);
buf[..chunk.len()].copy_from_slice(chunk);
buf[chunk.len()] = 1;
Expand Down

0 comments on commit 727ed8f

Please sign in to comment.