22
33use elliptic_curve:: array:: typenum:: NonZero ;
44use elliptic_curve:: array:: { Array , ArraySize } ;
5+ use elliptic_curve:: group:: cofactor:: CofactorGroup ;
56use elliptic_curve:: ops:: Reduce ;
67use elliptic_curve:: { CurveArithmetic , ProjectivePoint } ;
78
89/// Trait for converting field elements into a point via a mapping method like
910/// Simplified Shallue-van de Woestijne-Ulas or Elligator.
10- pub trait MapToCurve : CurveArithmetic < Scalar : Reduce < Array < u8 , Self :: ScalarLength > > > {
11+ pub trait MapToCurve :
12+ CurveArithmetic <
13+ ProjectivePoint : CofactorGroup < Subgroup = Self :: ProjectivePoint > ,
14+ Scalar : Reduce < Array < u8 , Self :: ScalarLength > > ,
15+ >
16+ {
1117 /// The field element representation for a group value with multiple elements.
1218 type FieldElement : Reduce < Array < u8 , Self :: FieldLength > > + Default + Copy ;
1319 /// The `L` parameter as specified in the [RFC](https://www.rfc-editor.org/rfc/rfc9380.html#section-5-6) for field elements.
@@ -17,17 +23,4 @@ pub trait MapToCurve: CurveArithmetic<Scalar: Reduce<Array<u8, Self::ScalarLengt
1723
1824 /// Map a field element into a curve point.
1925 fn map_to_curve ( element : Self :: FieldElement ) -> ProjectivePoint < Self > ;
20-
21- /// Map a curve point to a point in the curve subgroup.
22- /// This is usually done by clearing the cofactor, if necessary.
23- fn map_to_subgroup ( point : ProjectivePoint < Self > ) -> ProjectivePoint < Self > ;
24-
25- /// Combine two curve points into a point in the curve subgroup.
26- /// This is usually done by clearing the cofactor of the sum.
27- fn add_and_map_to_subgroup (
28- lhs : ProjectivePoint < Self > ,
29- rhs : ProjectivePoint < Self > ,
30- ) -> ProjectivePoint < Self > {
31- Self :: map_to_subgroup ( lhs + rhs)
32- }
3326}
0 commit comments