@@ -79,23 +79,30 @@ pub fn le_bytes_iter(n: u32) -> impl_indexed_iter!(<Item = [u8; 4]>) {
7979 cfg_into_iter ! ( 0 ..n) . map ( u32:: to_le_bytes)
8080}
8181
82- /// Produces `n` projective group elements by combining the supplied bytes with the `u32::to_le_bytes` counter bytes.
82+ /// Produces an iterator of little endian bytes of each element contained in the range `counter_range`
83+ pub fn le_bytes_iter_from_given_range (
84+ counter_range : Range < u32 > ,
85+ ) -> impl_indexed_iter ! ( <Item = [ u8 ; 4 ] >) {
86+ cfg_into_iter ! ( counter_range) . map ( u32:: to_le_bytes)
87+ }
88+
89+ /// Produces an iterator of projective group elements created by hashing a label and a counter in the range `counter_range`
8390pub fn n_projective_group_elements < ' iter , G , D > (
84- n : u32 ,
91+ counter_range : Range < u32 > ,
8592 bytes : & ' iter [ u8 ] ,
8693) -> impl_indexed_iter ! ( <Item = G :: Group > + ' iter)
8794where
8895 G : AffineRepr + SendIfParallel ,
8996 D : Digest ,
9097{
91- le_bytes_iter ( n ) . map ( move |ctr_bytes| -> G :: Group {
98+ le_bytes_iter_from_given_range ( counter_range ) . map ( move |ctr_bytes| -> G :: Group {
9299 projective_group_elem_from_try_and_incr :: < G , D > ( & concat_slices ! ( bytes. as_ref( ) , ctr_bytes) )
93100 } )
94101}
95102
96- /// Produces `n` affine group elements by combining the supplied bytes with the `u32::to_le_bytes` counter bytes.
103+ /// Produces an iterator affine group elements created by hashing a label and a counter in the range `counter_range`
97104pub fn n_affine_group_elements < ' iter , G , D > (
98- n : u32 ,
105+ n : Range < u32 > ,
99106 bytes : & ' iter [ u8 ] ,
100107) -> impl_indexed_iter ! ( <Item = G > + ' iter)
101108where
0 commit comments