Skip to content

Commit c5df7a5

Browse files
committed
blake2b/s: simplify update
1 parent 718f57e commit c5df7a5

File tree

1 file changed

+1
-13
lines changed

1 file changed

+1
-13
lines changed

blake2/src/blake2.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -311,25 +311,13 @@ macro_rules! blake2_impl {
311311
.expect("hash data length overflow");
312312
}
313313

314-
while rest.len() >= block {
314+
for part in rest.chunks(block) {
315315
self.h.compress(&self.m, 0, 0, self.t);
316316

317-
let part = &rest[..block];
318-
rest = &rest[part.len()..];
319-
320317
copy(part, &mut self.m.as_mut_bytes());
321318
self.t = self.t.checked_add(part.len() as u64)
322319
.expect("hash data length overflow");
323320
}
324-
325-
let n = rest.len();
326-
if n > 0 {
327-
self.h.compress(&self.m, 0, 0, self.t);
328-
329-
copy(rest, &mut self.m.as_mut_bytes());
330-
self.t = self.t.checked_add(rest.len() as u64)
331-
.expect("hash data length overflow");
332-
}
333321
}
334322

335323
#[doc(hidden)]

0 commit comments

Comments
 (0)