tiny-keccak
tiny-keccak copied to clipboard
Allow resetting Keccak internal buffer by zeroing out
I would like to be able to reset the internal KeccakState
of a Keccak
instance so that its buffer and offset are zeroed out. I can see that there is a method reset
on KeccakState
, which however is only ever called from KangarooTwelve
.
It is possible to provide a reset
method on Keccak
calling KeccakState:reset
? Is there maybe a reason why there is no such method? I can otherwise provide a PR, but I wanted to ask first.
Hi @debris , would you be open to providing a reset
method on Keccak
so that we can zero out the buffer there?
One thing to note: cSHAKE, and all cSHAKE-based functions, cannot straightly expose the reset
method, because cSHAKE has a process of initialization based on name
and custom_string
, in other words the "initial" Buffer
state is not all zero. You can refer to RustCrypto's cSHAKE implementation. However, Keccak, SHA3 and SHAKE do not have an initialization process, so you can straightly expose the reset
method.