Closed rijnhard closed 6 years ago
unless of course you should be able to create and carry on reusing one instance, in which case finalizing should not be implemented for shake/cshake based functions (including kmac etc).
It has to finalize before result returns. Node crypto also does this. You're right. I should throw an error when you try to update again after finalizing. I will add this feature.
v0.8.0 will throw an error
so take the following misconception: looking at the docs you could easily draw the wrong conclusion that you can instantiate an algorithm and then simply update and reuse it. Being "smart" devs this looks like a good idea as it presumably increases performance.
But that isn't true, here's what happens:
In this case, calling update on a finalized hasher is invalid, but since it doesn't error you aren't aware that your usage is invalid, which can lead to some nasty bugs in userland.