Struct StarknetCurveConfig

Source
pub struct StarknetCurveConfig;
Expand description

The Stark curve in the arkworks short Weierstrass curve representation

Trait Implementations§

Source§

impl CurveConfig for StarknetCurveConfig

Source§

const COFACTOR: &'static [u64]

The cofactor of this curve, represented as a sequence of little-endian limbs.
Source§

const COFACTOR_INV: Self::ScalarField

Source§

type BaseField = Fp<MontBackend<StarknetFqConfig, 4>, 4>

Base field that the curve is defined over.
Source§

type ScalarField = Fp<MontBackend<StarknetFrConfig, 4>, 4>

Finite prime field corresponding to an appropriate prime-order subgroup of the curve group.
Source§

fn cofactor_is_one() -> bool

Source§

impl SWCurveConfig for StarknetCurveConfig

See https://docs.starkware.co/starkex/crypto/stark-curve.html for curve parameters

Source§

const COEFF_A: Self::BaseField

Coefficient a of the curve equation.
Source§

const COEFF_B: Self::BaseField

Coefficient b of the curve equation.
Source§

const GENERATOR: Affine<Self>

Generator of the prime-order subgroup.
Source§

fn mul_by_a(elem: Self::BaseField) -> Self::BaseField

Helper method for computing elem * Self::COEFF_A. Read more
Source§

fn add_b(elem: Self::BaseField) -> Self::BaseField

Helper method for computing elem + Self::COEFF_B. Read more
Source§

fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool

Check if the provided curve point is in the prime-order subgroup. Read more
Source§

fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>

Performs cofactor clearing. The default method is simply to multiply by the cofactor. Some curves can implement a more efficient algorithm.
Source§

fn mul_projective(base: &Projective<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for projective coordinates
Source§

fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>

Default implementation of group multiplication for affine coordinates.
Source§

fn msm( bases: &[Affine<Self>], scalars: &[Self::ScalarField], ) -> Result<Projective<Self>, usize>

Default implementation for multi scalar multiplication
Source§

fn serialize_with_mode<W>( item: &Affine<Self>, writer: W, compress: Compress, ) -> Result<(), SerializationError>
where W: Write,

If uncompressed, serializes both x and y coordinates as well as a bit for whether it is infinity. If compressed, serializes x coordinate with two bits to encode whether y is positive, negative, or infinity.
Source§

fn deserialize_with_mode<R>( reader: R, compress: Compress, validate: Validate, ) -> Result<Affine<Self>, SerializationError>
where R: Read,

If validate is Yes, calls check() to make sure the element is valid.
Source§

fn serialized_size(compress: Compress) -> usize

Source§

impl SWUConfig for StarknetCurveConfig

Defines the \zeta constant for the SWU map to curve implementation

Source§

const ZETA: Self::BaseField

An element of the base field that is not a square root see [WB2019, Section 4]. It is also convenient to have $g(b/ZETA * a)$ to be square. In general we use a ZETA with low absolute value coefficients when they are represented as integers.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more