Struct ark_bls12_377::g1::Config
source · 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
§type BaseField = Fp<MontBackend<FqConfig, 6>, 6>
type BaseField = Fp<MontBackend<FqConfig, 6>, 6>
§type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>
type ScalarField = Fp<MontBackend<FrConfig, 4>, 4>
fn cofactor_is_one() -> bool
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
§type TECurveConfig = Config
type TECurveConfig = Config
source§impl PartialEq<Config> for Config
impl PartialEq<Config> for 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 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_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,
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)