Skip to content

Commit

Permalink
Arrabbiata/curve: implement squeeze_challenge
Browse files Browse the repository at this point in the history
Alias for sponge.challenge()
  • Loading branch information
dannywillems committed Feb 12, 2025
1 parent ad6a4cb commit 1c9245c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions arrabbiata/src/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ where
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
);

/// Coin a challenge from the sponge.
/// Note that a challenge set might not be covering the whole set the scalar
/// field is defined on.
///
/// In particular, for the Pasta curves, a 128-bits value is expected as an
/// output.
fn squeeze_challenge(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
) -> Self::ScalarField;
}

impl ArrabbiataCurve for Affine<PallasParameters> {
Expand Down Expand Up @@ -136,6 +146,12 @@ impl ArrabbiataCurve for Affine<PallasParameters> {
) {
sponge.absorb_g(comms)
}

fn squeeze_challenge(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
) -> Self::ScalarField {
sponge.challenge()
}
}

impl ArrabbiataCurve for Affine<VestaParameters> {
Expand Down Expand Up @@ -184,4 +200,10 @@ impl ArrabbiataCurve for Affine<VestaParameters> {
) {
sponge.absorb_g(comms)
}

fn squeeze_challenge(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
) -> Self::ScalarField {
sponge.challenge()
}
}

0 comments on commit 1c9245c

Please sign in to comment.