-
Notifications
You must be signed in to change notification settings - Fork 49
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
alloc independent hash_to_curve
API
#46
Comments
I tried to maintain the current API, ending up with these modifications pub struct Hasher<'a, Field, Curve, IsoCurve> {
domain_prefix: &'a str,
_marker1: PhantomData<Field>,
_marker2: PhantomData<Curve>,
_marker3: PhantomData<IsoCurve>,
}
impl<'a, F, C, I> Fn<(&[u8],)> for Hasher<'a, F, C, I>
where
F: FieldExt,
C: CurveExt<Base = F> + CurveConstants,
I: CurveExt<Base = F>,
{
extern "rust-call" fn call(&self, args: (&[u8],)) -> C {
let (message,) = args;
...
}
} #[cfg(feature = "unboxed_closures")]
fn hash_to_curve<'a>(domain_prefix: &'a str) -> Hasher<'a, $base, $name, $iso> {
Hasher::new(domain_prefix)
} Unfortunately this requires unstable features Another small but necessary change is to move You can find a proof of concept here: https://github.com/jarys/pasta_curves/tree/unboxed-closures |
Ideally we could have a generic alloc-free implementation in the |
You don't have to. I was just an attempt to make required changes without breaking the curent |
I would really appreciate, if some alloc independent version of
hash_to_curve
got into upstream.By modifying the current API? Or adding an alternative API? @str4d
The text was updated successfully, but these errors were encountered: