-
Notifications
You must be signed in to change notification settings - Fork 51
Description
This method cannot be implemented outside of the package - therefore you need to fork repository to add custom
Hasherimplementation. I think, entire idea behindHasherinterface was to enable easy replacement when nmt is used as library.Both interface (type) and method has to be visible so they could be implemented. I would also suggest putting it next to
Hasherinterface definition.
Originally posted by @tzdybal in #305 (comment)
As discussed in PR, there is some space for interface cleanup.
Currently API is a bit confusing, because you can configure "ReuseBuffers", but you can't create custom Hasher implementation that will reuse buffers (yet you can create own hasher implementation in general).
The comments in the code suggest Hasher interface is mostly used for tests, and for production it's not recommended to use anything other than NmtHasher - if it's the case, we should "hide" Hasher interface.
This is obviously a breaking change and we need to release a new version.
We can add Reset function to Hasher (or hasher) (typical for hash functions of any sort) so we can easily reset implementation state as needed, without casting, etc.