mirror of
https://github.com/arnaucube/ark-curves-cherry-picked.git
synced 2026-01-11 08:21:33 +01:00
Update BLS12-381
This commit is contained in:
@@ -3,10 +3,7 @@ use ark_ec::{
|
||||
bls12,
|
||||
models::{ModelParameters, SWModelParameters},
|
||||
};
|
||||
use ark_ff::{
|
||||
biginteger::{BigInteger256, BigInteger384},
|
||||
field_new, Zero,
|
||||
};
|
||||
use ark_ff::{field_new, Zero};
|
||||
|
||||
pub type G1Affine = bls12::G1Affine<crate::Parameters>;
|
||||
pub type G1Projective = bls12::G1Projective<crate::Parameters>;
|
||||
@@ -21,18 +18,11 @@ impl ModelParameters for Parameters {
|
||||
|
||||
impl SWModelParameters for Parameters {
|
||||
/// COEFF_A = 0
|
||||
const COEFF_A: Fq = field_new!(Fq, BigInteger384([0x0, 0x0, 0x0, 0x0, 0x0, 0x0]));
|
||||
const COEFF_A: Fq = field_new!(Fq, "0");
|
||||
|
||||
/// COEFF_B = 4
|
||||
#[rustfmt::skip]
|
||||
const COEFF_B: Fq = field_new!(Fq, BigInteger384([
|
||||
0xaa270000000cfff3,
|
||||
0x53cc0032fc34000a,
|
||||
0x478fe97a6b0a807f,
|
||||
0xb1d37ebee6ba24d7,
|
||||
0x8ec9733bbf78ab2f,
|
||||
0x9d645513d83de7e,
|
||||
]));
|
||||
const COEFF_B: Fq = field_new!(Fq, "4");
|
||||
|
||||
/// COFACTOR = (x - 1)^2 / 3 = 76329603384216526031706109802092473003
|
||||
const COFACTOR: &'static [u64] = &[0x8c00aaab0000aaab, 0x396c8c005555e156];
|
||||
@@ -40,12 +30,7 @@ impl SWModelParameters for Parameters {
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r
|
||||
/// = 52435875175126190458656871551744051925719901746859129887267498875565241663483
|
||||
#[rustfmt::skip]
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
|
||||
288839107172787499,
|
||||
1152722415086798946,
|
||||
2612889808468387987,
|
||||
5124657601728438008,
|
||||
]));
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, "52435875175126190458656871551744051925719901746859129887267498875565241663483");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G1_GENERATOR_X, G1_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
@@ -60,23 +45,9 @@ impl SWModelParameters for Parameters {
|
||||
/// G1_GENERATOR_X =
|
||||
/// 3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507
|
||||
#[rustfmt::skip]
|
||||
pub const G1_GENERATOR_X: Fq = field_new!(Fq, BigInteger384([
|
||||
0x5cb38790fd530c16,
|
||||
0x7817fc679976fff5,
|
||||
0x154f95c7143ba1c1,
|
||||
0xf0ae6acdf3d0e747,
|
||||
0xedce6ecc21dbf440,
|
||||
0x120177419e0bfb75,
|
||||
]));
|
||||
pub const G1_GENERATOR_X: Fq = field_new!(Fq, "3685416753713387016781088315183077757961620795782546409894578378688607592378376318836054947676345821548104185464507");
|
||||
|
||||
/// G1_GENERATOR_Y =
|
||||
/// 1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569
|
||||
#[rustfmt::skip]
|
||||
pub const G1_GENERATOR_Y: Fq = field_new!(Fq, BigInteger384([
|
||||
0xbaac93d50ce72271,
|
||||
0x8c22631a7918fd8e,
|
||||
0xdd595f13570725ce,
|
||||
0x51ac582950405194,
|
||||
0xe1c8c3fad0059c0,
|
||||
0xbbc3efc5008a26a,
|
||||
]));
|
||||
pub const G1_GENERATOR_Y: Fq = field_new!(Fq, "1339506544944476473020471379941921221584933875938349620426543736416511423956333506472724655353366534992391756441569");
|
||||
|
||||
@@ -3,10 +3,7 @@ use ark_ec::{
|
||||
bls12,
|
||||
models::{ModelParameters, SWModelParameters},
|
||||
};
|
||||
use ark_ff::{
|
||||
biginteger::{BigInteger256, BigInteger384},
|
||||
field_new, Zero,
|
||||
};
|
||||
use ark_ff::{field_new, Zero};
|
||||
|
||||
pub type G2Affine = bls12::G2Affine<crate::Parameters>;
|
||||
pub type G2Projective = bls12::G2Projective<crate::Parameters>;
|
||||
@@ -44,12 +41,7 @@ impl SWModelParameters for Parameters {
|
||||
/// COFACTOR_INV = COFACTOR^{-1} mod r
|
||||
/// 26652489039290660355457965112010883481355318854675681319708643586776743290055
|
||||
#[rustfmt::skip]
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, BigInteger256([
|
||||
6746407649509787816,
|
||||
1304054119431494378,
|
||||
2461312685643913071,
|
||||
5956596749362435284,
|
||||
]));
|
||||
const COFACTOR_INV: Fr = field_new!(Fr, "26652489039290660355457965112010883481355318854675681319708643586776743290055");
|
||||
|
||||
/// AFFINE_GENERATOR_COEFFS = (G2_GENERATOR_X, G2_GENERATOR_Y)
|
||||
const AFFINE_GENERATOR_COEFFS: (Self::BaseField, Self::BaseField) =
|
||||
@@ -67,47 +59,19 @@ pub const G2_GENERATOR_Y: Fq2 = field_new!(Fq2, G2_GENERATOR_Y_C0, G2_GENERATOR_
|
||||
/// G2_GENERATOR_X_C0 =
|
||||
/// 352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, BigInteger384([
|
||||
0xf5f28fa202940a10,
|
||||
0xb3f5fb2687b4961a,
|
||||
0xa1a893b53e2ae580,
|
||||
0x9894999d1a3caee9,
|
||||
0x6f67b7631863366b,
|
||||
0x58191924350bcd7,
|
||||
]));
|
||||
pub const G2_GENERATOR_X_C0: Fq = field_new!(Fq, "352701069587466618187139116011060144890029952792775240219908644239793785735715026873347600343865175952761926303160");
|
||||
|
||||
/// G2_GENERATOR_X_C1 =
|
||||
/// 3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, BigInteger384([
|
||||
0xa5a9c0759e23f606,
|
||||
0xaaa0c59dbccd60c3,
|
||||
0x3bb17e18e2867806,
|
||||
0x1b1ab6cc8541b367,
|
||||
0xc2b6ed0ef2158547,
|
||||
0x11922a097360edf3,
|
||||
]));
|
||||
pub const G2_GENERATOR_X_C1: Fq = field_new!(Fq, "3059144344244213709971259814753781636986470325476647558659373206291635324768958432433509563104347017837885763365758");
|
||||
|
||||
/// G2_GENERATOR_Y_C0 =
|
||||
/// 1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, BigInteger384([
|
||||
0x4c730af860494c4a,
|
||||
0x597cfa1f5e369c5a,
|
||||
0xe7e6856caa0a635a,
|
||||
0xbbefb5e96e0d495f,
|
||||
0x7d3a975f0ef25a2,
|
||||
0x83fd8e7e80dae5,
|
||||
]));
|
||||
pub const G2_GENERATOR_Y_C0: Fq = field_new!(Fq, "1985150602287291935568054521177171638300868978215655730859378665066344726373823718423869104263333984641494340347905");
|
||||
|
||||
/// G2_GENERATOR_Y_C1 =
|
||||
/// 927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582
|
||||
#[rustfmt::skip]
|
||||
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, BigInteger384([
|
||||
0xadc0fc92df64b05d,
|
||||
0x18aa270a2b1461dc,
|
||||
0x86adac6a3be4eba0,
|
||||
0x79495c4ec93da33a,
|
||||
0xe7175850a43ccaed,
|
||||
0xb2bc2a163de1bf2,
|
||||
]));
|
||||
pub const G2_GENERATOR_Y_C1: Fq = field_new!(Fq, "927553665492332455747201965776037880757740193453592970025027978793976877002675564980949289727957565575433344219582");
|
||||
|
||||
Reference in New Issue
Block a user