Skip to content

Consider API cleanup #308

@tzdybal

Description

@tzdybal

This method cannot be implemented outside of the package - therefore you need to fork repository to add custom Hasher implementation. I think, entire idea behind Hasher interface 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 Hasher interface 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions