There are a few places in the Sha3 hash and XOF implementation where we're allocating buffers on the stack which are not strictly needed. Removing these allocations could improve performance and reduce stack usage of the implementation.
Getting rid of the buffering in the XOF implementation could also enable us to unify the incremental and one-shot implementations, without a draw-back for the one-shot APIs.
Examples of such allocations:
|
let mut state_flat = [0u64; 25]; |
|
// Buffer inputs on absorb. |
|
buf: [[u8; RATE]; PARALLEL_LANES], |
And the squueze_buf introduced in #1389.
There are a few places in the Sha3 hash and XOF implementation where we're allocating buffers on the stack which are not strictly needed. Removing these allocations could improve performance and reduce stack usage of the implementation.
Getting rid of the buffering in the XOF implementation could also enable us to unify the incremental and one-shot implementations, without a draw-back for the one-shot APIs.
Examples of such allocations:
libcrux/crates/algorithms/sha3/src/simd/portable.rs
Line 66 in e83007e
libcrux/crates/algorithms/sha3/src/generic_keccak/xof.rs
Lines 29 to 30 in e83007e
And the
squueze_bufintroduced in #1389.