Skip to content

Commit

Permalink
Arrabbiata/curve: introduce absorb_curve_points
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Jan 30, 2025
1 parent effadea commit 51266d7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions arrabbiata/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ where
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
fq: Self::BaseField,
);

/// Absorb a list of curve points into the sponge.
///
/// This method is supposed to be an alias to `sponge.absorb_g(&[gs])`.
/// However, it seems that the compiler requests some additional type
/// constraints if there is generic code over the trait `ArrabbiataCurve`.
fn absorb_curve_points(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
);
}

impl ArrabbiataCurve for Affine<PallasParameters> {
Expand Down Expand Up @@ -119,6 +129,13 @@ impl ArrabbiataCurve for Affine<PallasParameters> {
) {
sponge.absorb_fq(&[fq])
}

fn absorb_curve_points(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
) {
sponge.absorb_g(comms)
}
}

impl ArrabbiataCurve for Affine<VestaParameters> {
Expand Down Expand Up @@ -160,4 +177,11 @@ impl ArrabbiataCurve for Affine<VestaParameters> {
) {
sponge.absorb_fq(&[fq])
}

fn absorb_curve_points(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
) {
sponge.absorb_g(comms)
}
}

0 comments on commit 51266d7

Please sign in to comment.