From 11dc2640eb312762931492142a84a167c31ebbe3 Mon Sep 17 00:00:00 2001 From: Skalman Date: Tue, 31 Aug 2021 17:07:50 -0400 Subject: [PATCH] fixes #2 --- ec/src/hashing/curve_maps/swu/mod.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ec/src/hashing/curve_maps/swu/mod.rs b/ec/src/hashing/curve_maps/swu/mod.rs index f76959b3d..fed74daad 100644 --- a/ec/src/hashing/curve_maps/swu/mod.rs +++ b/ec/src/hashing/curve_maps/swu/mod.rs @@ -6,7 +6,8 @@ use crate::models::SWModelParameters; use crate::hashing::map_to_curve_hasher::MapToCurve; use crate::hashing::HashToCurveError; -use crate::AffineCurve; +use crate::{AffineCurve}; +use crate::models::short_weierstrass_jacobian::GroupAffine; /// Implementation for the SWU hash to curve for the curves of Weierstrass form of y^2 = x^3 + a*x + b where ab != 0. From [WB2019] /// @@ -38,21 +39,21 @@ pub struct SWU_hasher { curve_params: PhantomData P>, } -impl MapToCurve for SWU_hasher

{ +impl MapToCurve> for SWU_hasher

{ ///This is to verify if the provided SWUparams makes sense, doesn't do much for now fn new_map_to_curve(domain: &[u8]) -> Result { Ok(SWU_hasher { - domain, - PhantomData, + domain: domain.to_vec(), + curve_params: PhantomData, }) } /// Map random field point to a random curve point /// inspired from /// https://github.com/zcash/pasta_curves/blob/main/src/hashtocurve.rs - fn map_to_curve(&self, point: T::BaseField) -> Result { + fn map_to_curve(&self, point: as AffineCurve>::BaseField) -> Result, HashToCurveError> { // 1. tv1 = inv0(Z^2 * u^4 + Z * u^2) // 2. x1 = (-B / A) * (1 + tv1) // 3. If tv1 == 0, set x1 = B / (Z * A)