pub struct JubjubConfig;
Expand description

JubJub is a twisted Edwards curve. These curves have equations of the form: ax² + y² = 1 - dx²y². over some base finite field Fq.

JubJub’s curve equation: -x² + y² = 1 - (10240/10241)x²y²

q = 52435875175126190479447740508185965837690552500527637822603658699938581184513.

a = -1. d = -(10240/10241) mod q = 19257038036680949359750312669786877991949435402254120286184196891950884077233.

Sage script to calculate these:

q = 52435875175126190479447740508185965837690552500527637822603658699938581184513
Fq = GF(q)
d = -(Fq(10240)/Fq(10241))

These parameters and the sage script obtained from: https://github.com/zcash/zcash/issues/2230#issuecomment-317182190

jubjub also has a short Weierstrass curve form, following the form: y² = x³ + A * x + B where

A = 52296097456646850916096512823759002727550416093741407922227928430486925478210 B = 48351165704696163914533707656614864561753505123260775585269522553028192119009

We can use the script available here to convert between the different representations.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

COFACTOR = 8

COFACTOR^(-1) mod r = 819310549611346726241370945440405716213240158234039660170669895299022906775

Base field that the curve is defined over.
Finite prime field corresponding to an appropriate prime-order subgroup of the curve group.
Returns the “default value” for a type. Read more

COEFF_A = 40962

COEFF_B = -40964

Model parameters for the Twisted Edwards curve that is birationally equivalent to this curve.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

COEFF_A = 52296097456646850916096512823759002727550416093741407922227928430486925478210

COEFF_B = 48351165704696163914533707656614864561753505123260775585269522553028192119009

generators

Helper method for computing elem * Self::COEFF_A. Read more
Helper method for computing elem + Self::COEFF_B. Read more
Check if the provided curve point is in the prime-order subgroup. Read more
Performs cofactor clearing. The default method is simply to multiply by the cofactor. Some curves can implement a more efficient algorithm.
Default implementation of group multiplication for projective coordinates
Default implementation of group multiplication for affine coordinates.
Default implementation for multi scalar multiplication
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.
If validate is Yes, calls check() to make sure the element is valid.

COEFF_A = -1

COEFF_D = -(10240/10241) mod q

AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)

Multiplication by a is simply negation here.

Model parameters for the Montgomery curve that is birationally equivalent to this curve.
Checks that the current point is in the prime order subgroup given the point on the curve.
Performs cofactor clearing. The default method is simply to multiply by the cofactor. For some curve families though, it is sufficient to multiply by a smaller scalar.
Default implementation of group multiplication for projective coordinates
Default implementation of group multiplication for affine coordinates
Default implementation for multi scalar multiplication
If uncompressed, serializes both x and y coordinates. If compressed, serializes y coordinate with a bit to encode whether x is positive.
If validate is Yes, calls check() to make sure the element is valid. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Checks if this value is equivalent to the given key. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.