pub struct Config;
Trait Implementations§
Source§impl CurveConfig for Config
impl CurveConfig for Config
Source§const COFACTOR: &'static [u64] = _
const COFACTOR: &'static [u64] = _
COFACTOR = (x - 1)^2 / 3 = 30631250834960419227450344600217059328
Source§const COFACTOR_INV: Fr = _
const COFACTOR_INV: Fr = _
COFACTOR_INV = COFACTOR^{-1} mod r = 5285428838741532253824584287042945485047145357130994810877
Source§type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>
type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>
fn cofactor_is_one() -> bool
Source§impl GLVConfig for Config
impl GLVConfig for Config
Source§const ENDO_COEFFS: &'static [Self::BaseField] = _
const ENDO_COEFFS: &'static [Self::BaseField] = _
phi(G) := lambda*G
.
The coefficients of the endomorphismSource§const LAMBDA: Self::ScalarField = _
const LAMBDA: Self::ScalarField = _
Source§const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = _
const SCALAR_DECOMP_COEFFS: [(bool, <Self::ScalarField as PrimeField>::BigInt); 4] = _
ScalarField::characteristic()
.fn endomorphism(p: &SWProjective<Self>) -> SWProjective<Self>
fn endomorphism_affine(p: &SWAffine<Self>) -> SWAffine<Self>
Source§fn scalar_decomposition(
k: Self::ScalarField,
) -> ((bool, Self::ScalarField), (bool, Self::ScalarField))
fn scalar_decomposition( k: Self::ScalarField, ) -> ((bool, Self::ScalarField), (bool, Self::ScalarField))
fn glv_mul_projective( p: Projective<Self>, k: Self::ScalarField, ) -> Projective<Self>
fn glv_mul_affine(p: Affine<Self>, k: Self::ScalarField) -> Affine<Self>
Source§impl MontCurveConfig for Config
impl MontCurveConfig for Config
Source§const COEFF_A: Fq = _
const COEFF_A: Fq = _
COEFF_A = 228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384
Source§const COEFF_B: Fq = _
const COEFF_B: Fq = _
COEFF_B = 10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931
Source§type TECurveConfig = Config
type TECurveConfig = Config
Source§impl SWCurveConfig for Config
impl SWCurveConfig for Config
Source§const GENERATOR: G1SWAffine = _
const GENERATOR: G1SWAffine = _
AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
Source§fn mul_by_a(_: Self::BaseField) -> Self::BaseField
fn mul_by_a(_: Self::BaseField) -> Self::BaseField
elem * Self::COEFF_A
. Read moreSource§fn mul_projective(p: &G1Projective, scalar: &[u64]) -> G1Projective
fn mul_projective(p: &G1Projective, scalar: &[u64]) -> G1Projective
Source§fn clear_cofactor(p: &G1SWAffine) -> G1SWAffine
fn clear_cofactor(p: &G1SWAffine) -> G1SWAffine
Source§fn add_b(elem: Self::BaseField) -> Self::BaseField
fn add_b(elem: Self::BaseField) -> Self::BaseField
elem + Self::COEFF_B
. Read moreSource§fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool
fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool
Source§fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>
fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>
Source§fn msm(
bases: &[Affine<Self>],
scalars: &[Self::ScalarField],
) -> Result<Projective<Self>, usize>
fn msm( bases: &[Affine<Self>], scalars: &[Self::ScalarField], ) -> Result<Projective<Self>, usize>
Source§fn serialize_with_mode<W>(
item: &Affine<Self>,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
fn serialize_with_mode<W>(
item: &Affine<Self>,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
Source§fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Affine<Self>, SerializationError>where
R: Read,
fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Affine<Self>, SerializationError>where
R: Read,
validate
is Yes
, calls check()
to make sure the element is valid.fn serialized_size(compress: Compress) -> usize
Source§impl TECurveConfig for Config
impl TECurveConfig for Config
Bls12_377::G1 also has a twisted Edwards form. It can be obtained via the following script, implementing
- SW -> Montgomery -> TE1 transformation: https://en.wikipedia.org/wiki/Montgomery_curve
- TE1 -> TE2 normalization (enforcing
a = -1
)
# modulus
p = 0x1ae3a4617c510eac63b05c06ca1493b1a22d9f300f5138f1ef3622fba094800170b5d44300000008508c00000000001
Fp = Zmod(p)
#####################################################
# Weierstrass curve: y² = x³ + A * x + B
#####################################################
# curve y^2 = x^3 + 1
WA = Fp(0)
WB = Fp(1)
#####################################################
# Montgomery curve: By² = x³ + A * x² + x
#####################################################
# root for x^3 + 1 = 0
alpha = -1
# s = 1 / (sqrt(3alpha^2 + a))
s = 1/(Fp(3).sqrt())
# MA = 3 * alpha * s
MA = Fp(228097355113300204138531148905234651262148041026195375645000724271212049151994375092458297304264351187709081232384)
# MB = s
MB = Fp(10189023633222963290707194929886294091415157242906428298294512798502806398782149227503530278436336312243746741931)
# #####################################################
# # Twisted Edwards curve 1: a * x² + y² = 1 + d * x² * y²
# #####################################################
# We first convert to TE form obtaining a curve with a != -1, and then
# apply a transformation to obtain a TE curve with a = -1.
# a = (MA+2)/MB
TE1a = Fp(61134141799337779744243169579317764548490943457438569789767076791016838392692895365021181670618017873462480451583)
# b = (MA-2)/MB
TE1d = Fp(197530284213631314266409564115575768987902569297476090750117185875703629955647927409947706468955342250977841006588)
# #####################################################
# # Twisted Edwards curve 2: a * x² + y² = 1 + d * x² * y²
# #####################################################
# a = -1
TE2a = Fp(-1)
# b = -TE1d/TE1a
TE2d = Fp(122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179)
Source§const COEFF_D: Fq = _
const COEFF_D: Fq = _
COEFF_D = 122268283598675559488486339158635529096981886914877139579534153582033676785385790730042363341236035746924960903179 mod q
Source§const GENERATOR: G1TEAffine = _
const GENERATOR: G1TEAffine = _
AFFINE_GENERATOR_COEFFS = (GENERATOR_X, GENERATOR_Y)
Source§type MontCurveConfig = Config
type MontCurveConfig = Config
Source§fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool
fn is_in_correct_subgroup_assuming_on_curve(item: &Affine<Self>) -> bool
Source§fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>
fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>
Source§fn mul_projective(base: &Projective<Self>, scalar: &[u64]) -> Projective<Self>
fn mul_projective(base: &Projective<Self>, scalar: &[u64]) -> Projective<Self>
Source§fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>
fn mul_affine(base: &Affine<Self>, scalar: &[u64]) -> Projective<Self>
Source§fn msm(
bases: &[Affine<Self>],
scalars: &[Self::ScalarField],
) -> Result<Projective<Self>, usize>
fn msm( bases: &[Affine<Self>], scalars: &[Self::ScalarField], ) -> Result<Projective<Self>, usize>
Source§fn serialize_with_mode<W>(
item: &Affine<Self>,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
fn serialize_with_mode<W>(
item: &Affine<Self>,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
Source§fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Affine<Self>, SerializationError>where
R: Read,
fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Affine<Self>, SerializationError>where
R: Read,
fn serialized_size(compress: Compress) -> usize
Source§impl WBConfig for Config
impl WBConfig for Config
const ISOGENY_MAP: IsogenyMap<'static, Self::IsogenousCurve, Self> = ISOGENY_MAP_TO_G1
type IsogenousCurve = SwuIsoConfig
impl Eq for Config
impl StructuralPartialEq for Config
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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