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: FThe variable a in the definition of the curve
Implementations§
Source§impl<F: FieldOps + FieldRandom> JacobiIntersectionCurve<F>
impl<F: FieldOps + FieldRandom> JacobiIntersectionCurve<F>
Sourcepub fn new(a: F) -> Self
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}Sourcepub fn a_invariants(&self) -> [F; 1]
pub fn a_invariants(&self) -> [F; 1]
Returns the corresponding invariant a (not the a-invariants
of the Jacobian)
Sourcepub fn random_point(
&self,
rng: &mut (impl CryptoRng + Rng),
) -> JacobiIntersectionPoint<F>
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.
Sourcepub fn to_weierstrass_curve(&self) -> WeierstrassCurve<F>
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>
impl<F: Clone + FieldOps> Clone for JacobiIntersectionCurve<F>
Source§fn clone(&self) -> JacobiIntersectionCurve<F>
fn clone(&self) -> JacobiIntersectionCurve<F>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F: FieldOps + FieldRandom> Curve for JacobiIntersectionCurve<F>
impl<F: FieldOps + FieldRandom> Curve for JacobiIntersectionCurve<F>
Source§type Point = JacobiIntersectionPoint<F>
type Point = JacobiIntersectionPoint<F>
Native point representation for this curve model.
Source§fn is_on_curve(&self, point: &Self::Point) -> bool
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
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
fn j_invariant(&self) -> F
Return the j_invariant of the curve;
Source§impl<F> Display for JacobiIntersectionCurve<F>
impl<F> Display for JacobiIntersectionCurve<F>
impl<F: Eq + FieldOps> Eq for JacobiIntersectionCurve<F>
impl<F: FieldOps> StructuralPartialEq for JacobiIntersectionCurve<F>
Auto Trait Implementations§
impl<F> Freeze for JacobiIntersectionCurve<F>where
F: Freeze,
impl<F> RefUnwindSafe for JacobiIntersectionCurve<F>where
F: RefUnwindSafe,
impl<F> Send for JacobiIntersectionCurve<F>where
F: Send,
impl<F> Sync for JacobiIntersectionCurve<F>where
F: Sync,
impl<F> Unpin for JacobiIntersectionCurve<F>where
F: Unpin,
impl<F> UnsafeUnpin for JacobiIntersectionCurve<F>where
F: UnsafeUnpin,
impl<F> UnwindSafe for JacobiIntersectionCurve<F>where
F: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more