-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Per #32, specifically,
I think the generator side of this definitely needs some experimentation, because while there are logical reasons for choosing a particular generator as standard, they aren't as natural as the singular choice of Field::ONE.
yet reminded by #44, now proposing again extending the generator API, I'd like to consolidate discussion and provide a proposal.
The main reasons for the generator function are simply convenience. I'd assume most people using cryptography will always use a single generator. Not only is providing the presumed standard preventing acquiring it, it prevents having to pass it around everywhere. Defining a generator also opens optimizations such as #44. I believe my code lost 15% of its performance when I stopped using dalek's table...
The main issue is almost all points are usable as generators and there's many such reasons to use alternative generators, which I won't bother to iterate here. Removing the generator function to acknowledge this would negatively harm most users AND add frequently unnecessarily API complications as everyone now passes it around at every level.
My suggestion maintains the simple path, while offering further flexibility.
- Don't make
generator()const - Offer a (potentially-std only?) wrapper for Groups allowing overriding their generators
Ideally, in my 'I have not yet wrote a line of code to see how well this'd work' opinion, it'd be an RAII-style push to scope a distinct generator. Internally, I presume a static mut HashMap<ThreadId, Vec> could handle pushed generators? So long as the returned lock wasn't usable under async...
The benefit is that then, a theoretically Schnorr PoK crate, could simply call generator(), not needing to take in a generator in its API, yet still provide PoKs across any generator.
Due to the complexities of the latter, I'm not here to explicitly ask for it in group. Solely call for GENERATOR to remain non-constant. This doesn't conflict with #44, adding a non-const function, yet it's my thoughts on the matter. Of course, I'd love to hear @str4d's thoughts since they said experimentation was needed.