-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HashToCurve and Hasher: Add new() method #203
Comments
I like the idea in general a lot, though keep in mind the following (which was the main reason it was designed like this) - when instantiating a large BH hasher, we need to generate a lot of base points, which can take noticable time. |
That makes sense. In those cases, I believe that we could make them return copies of a lazily evaluated singleton instance. Another question is should the |
Yep, singleton instances might work here, which is similar to what we do now, but more explicitly. About domain, I don't have a strong preference either way. In the use-cases I'm imagining this optimization would be hard to apply anyway. |
The current HashToCurve / Hasher API's don't let one template over the Hash type. The issue at the moment is that the hash functions require operating on a struct instantiated elsewhere.
I suggest refactoring both of these to provide a
new() -> Result<Self, Self::Error>
API. Thedigest
Trait, which allows for generalizing over cryptographic hash function, does something similar with just having anew()
method.I'm currently working on such a change, and would be happy to upstream it
EDIT: Its done in this branch (https://github.com/sikkatech/celo-bls-snark-rs/tree/make_hashes_have_new_fn ), sans for fixing the same doctests that are blocking #202
The text was updated successfully, but these errors were encountered: