Skip to main content

JacobiIntersectionCurve

Struct JacobiIntersectionCurve 

Source
pub struct JacobiIntersectionCurve<F: FieldOps> {
    pub a: F,
}
Expand description

A Jacobi-intersection curve.

With the equation $$ s^2 + c^2 = 1, \quad a s^2 + d^2 = 1 $$ or $$ y^2 = x^3 + (2 - a)x^2 + (1 - a)x. $$

Fields§

§a: F

The variable a in the definition of the curve

Implementations§

Source§

impl<F: FieldOps + FieldRandom> JacobiIntersectionCurve<F>

Source

pub fn new(a: F) -> Self

Construct a Jacobi intersection from its parameter a.

Examples found in repository?
examples/ec_demo.rs (line 65)
41fn main() {
42    let mut rng = rand::rng();
43    // 1. Short Weierstrass over F_19: y^2 = x^3 + 2x + 3
44    let w = WeierstrassCurve::new_short(fp(2), fp(3));
45    show_curve("Weierstrass", &w, &mut rng);
46
47    // 2. Montgomery over F_19: B y^2 = x(x^2 + A x + 1)
48    // Smooth if B != 0 and A != ±2 in odd characteristic.
49    let m = MontgomeryCurve::new(fp(3), fp(1));
50    show_curve("Montgomery", &m, &mut rng);
51
52    // 3. Edwards over F_19: x^2 + y^2 = 1 + d x^2 y^2
53    // Pick d = 2 (nonzero, not 1; also a nonsquare in F_19).
54    let e = EdwardsCurve::new(fp(2));
55    show_curve("Edwards", &e, &mut rng);
56
57    // 4. Jacobi quartic over F_19: y^2 = d x^4 + 2 a x^2 + 1
58    // Need d != 0 and a^2 != d.
59    let jq = JacobiQuarticCurve::new(fp(3), fp(5));
60    show_curve("Jacobi quartic", &jq, &mut rng);
61
62    // 5. Jacobi intersection over F_19:
63    // s^2 + c^2 = 1,  a s^2 + d^2 = 1
64    // Need a != 0, 1.
65    let ji = JacobiIntersectionCurve::new(fp(2));
66    show_curve("Jacobi intersection", &ji, &mut rng);
67}
Source

pub fn is_smooth(a: &F) -> bool

Smoothness requirement: a != 0 and a != 1.

Source

pub fn contains(&self, s: &F, c: &F, d: &F) -> bool

Check both defining quadrics.

Source

pub fn a_invariants(&self) -> [F; 1]

Returns the corresponding invariant a (not the a-invariants of the Jacobian)

Source

pub fn random_point( &self, rng: &mut (impl CryptoRng + Rng), ) -> JacobiIntersectionPoint<F>

Sample a random affine point on this Jacobi-intersection curve using the provided RNG.

The method repeatedly samples s and then solves the defining quadrics for c and d by square-root extraction, returning a point (s, c, d) on the curve.

Source

pub fn to_weierstrass_curve(&self) -> WeierstrassCurve<F>

Birationally equivalent Weierstrass model $y^2 = x^3 + (2-a)x^2 + (1-a)x$.

Trait Implementations§

Source§

impl<F: Clone + FieldOps> Clone for JacobiIntersectionCurve<F>

Source§

fn clone(&self) -> JacobiIntersectionCurve<F>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: FieldOps + FieldRandom> Curve for JacobiIntersectionCurve<F>

Source§

type BaseField = F

Base field of the curve.
Source§

type Point = JacobiIntersectionPoint<F>

Native point representation for this curve model.
Source§

fn is_on_curve(&self, point: &Self::Point) -> bool

Return true if point is a valid point on this curve.
Source§

fn random_point(&self, rng: &mut (impl CryptoRng + Rng)) -> Self::Point

Return a random point that is on the curve.
Source§

fn j_invariant(&self) -> F

Return the j_invariant of the curve;
Source§

fn a_invariants(&self) -> Vec<Self::BaseField>

The interpretation depends on the curve model: Read more
Source§

fn identity(&self) -> Self::Point

Return the group identity.
Source§

impl<F: Debug + FieldOps> Debug for JacobiIntersectionCurve<F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F> Display for JacobiIntersectionCurve<F>
where F: FieldOps + Display,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<F: PartialEq + FieldOps> PartialEq for JacobiIntersectionCurve<F>

Source§

fn eq(&self, other: &JacobiIntersectionCurve<F>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: Eq + FieldOps> Eq for JacobiIntersectionCurve<F>

Source§

impl<F: FieldOps> StructuralPartialEq for JacobiIntersectionCurve<F>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.