pub trait ArrabbiataCurve: CommitmentCurve + EndoCurvewhere
Self::BaseField: PrimeField,{
type SpongeConstants: SpongeConstants;
const NAME: &'static str;
const SPONGE_CONSTANTS: Self::SpongeConstants;
// Required methods
fn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField>;
fn other_curve_sponge_params( ) -> &'static ArithmeticSpongeParams<Self::BaseField>;
fn endos() -> &'static (Self::BaseField, Self::ScalarField);
fn other_curve_endo() -> &'static Self::ScalarField;
fn get_curve_params() -> (Self::BaseField, Self::BaseField);
fn create_new_sponge( ) -> DefaultFqSponge<Self::Params, Self::SpongeConstants>;
fn absorb_fq(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
fq: Self::BaseField,
);
fn absorb_curve_points(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
);
fn squeeze_challenge(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
) -> Self::ScalarField;
}
Expand description
Represents additional information that a curve needs in order to be used with Arrabbiata.
The trait [CommitmentCurve] enforces the curve to be given in short Weierstrass form.
Required Associated Constants§
const SPONGE_CONSTANTS: Self::SpongeConstants
Required Associated Types§
type SpongeConstants: SpongeConstants
Required Methods§
Sourcefn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField>
fn sponge_params() -> &'static ArithmeticSpongeParams<Self::ScalarField>
Provides the sponge params to be used with this curve.
Sourcefn other_curve_sponge_params() -> &'static ArithmeticSpongeParams<Self::BaseField>
fn other_curve_sponge_params() -> &'static ArithmeticSpongeParams<Self::BaseField>
Provides the sponge params to be used with the other curve.
Sourcefn endos() -> &'static (Self::BaseField, Self::ScalarField)
fn endos() -> &'static (Self::BaseField, Self::ScalarField)
Provides the coefficients for the curve endomorphism, called (q,r) in some places.
Sourcefn other_curve_endo() -> &'static Self::ScalarField
fn other_curve_endo() -> &'static Self::ScalarField
Provides the coefficient for the curve endomorphism over the other field, called q in some places.
Sourcefn get_curve_params() -> (Self::BaseField, Self::BaseField)
fn get_curve_params() -> (Self::BaseField, Self::BaseField)
Return the coefficients a
and b
of the equation
y^2 = x^3 + a x + b
defining the curve.
Sourcefn create_new_sponge() -> DefaultFqSponge<Self::Params, Self::SpongeConstants>
fn create_new_sponge() -> DefaultFqSponge<Self::Params, Self::SpongeConstants>
Create a new sponge, with an empty state (i.e. initialized to zero).
Sourcefn absorb_fq(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
fq: Self::BaseField,
)
fn absorb_fq( sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>, fq: Self::BaseField, )
Absorb an element of the base field into the sponge.
This method is supposed to be an alias to sponge.absorb_fq(&[fq])
.
However, it seems that the compiler requests some additional type
constraints if there is generic code over the trait ArrabbiataCurve
.
Sourcefn absorb_curve_points(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
comms: &[Self],
)
fn absorb_curve_points( sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>, comms: &[Self], )
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
.
Sourcefn squeeze_challenge(
sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>,
) -> Self::ScalarField
fn squeeze_challenge( sponge: &mut DefaultFqSponge<Self::Params, Self::SpongeConstants>, ) -> Self::ScalarField
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.
This method is supposed to be an alias to sponge.challenge()
.
However, it seems that the compiler requests some additional type
constraints if there is generic code over the trait ArrabbiataCurve
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.