Skip to content

Commit

Permalink
Fix SHA3 with streaming
Browse files Browse the repository at this point in the history
Leftover bytes should be added to the buffer, not to the state.

(or, always to the state; we can and probably should eventually get
rid of the buffer)

Fixes ziglang#14851
  • Loading branch information
jedisct1 committed Mar 8, 2023
1 parent 06b2638 commit ff21309
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/std/crypto/keccak_p.zig
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ pub fn State(comptime f: u11, comptime capacity: u11, comptime delim: u8, compti
bytes = bytes[rate..];
}
if (bytes.len > 0) {
self.st.addBytes(bytes[0..]);
mem.copy(u8, &self.buf, bytes);
self.offset = bytes.len;
}
}
Expand Down

0 comments on commit ff21309

Please sign in to comment.