Skip to content

Commit

Permalink
docs: add comments to endo parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kilic committed Mar 1, 2023
1 parent abb34c3 commit de71b18
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/bn256/curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,19 @@ const G2_GENERATOR_Y: Fq2 = Fq2 {
]),
};

// Generated using https://github.com/ConsenSys/gnark-crypto/blob/master/ecc/utils.go
// with `bn256::Fr::ZETA`
// See https://github.com/demining/Endomorphism-Secp256k1/blob/main/README.md
// to have more details about the endomorphism.
const ENDO_PARAMS: EndoParameters = EndoParameters {
// round(b2/n)
gamma1: [
0x7a7bd9d4391eb18du64,
0x4ccef014a773d2cfu64,
0x0000000000000002u64,
0u64,
],
// round(-b1/n)
gamma2: [0xd91d232ec7e0b3d7u64, 0x0000000000000002u64, 0u64, 0u64],
b1: [0x8211bbeb7d4f1128u64, 0x6f4d8248eeb859fcu64, 0u64, 0u64],
b2: [0x89d3256894d213e3u64, 0u64, 0u64, 0u64],
Expand Down
12 changes: 12 additions & 0 deletions src/pasta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,27 @@ impl crate::CurveAffineExt for EqAffine {
}
}

// Generated using https://github.com/ConsenSys/gnark-crypto/blob/master/ecc/utils.go
// with `pasta_curves::Fp::ZETA`
// See https://github.com/demining/Endomorphism-Secp256k1/blob/main/README.md
// to have more details about the endomorphism.
const ENDO_PARAMS_EQ: EndoParameters = EndoParameters {
// round(b2/n)
gamma1: [0x32c49e4c00000003, 0x279a745902a2654e, 0x1, 0x0],
// round(-b1/n)
gamma2: [0x31f0256800000002, 0x4f34e8b2066389a4, 0x2, 0x0],
b1: [0x8cb1279300000001, 0x49e69d1640a89953, 0x0, 0x0],
b2: [0x0c7c095a00000001, 0x93cd3a2c8198e269, 0x0, 0x0],
};

// Generated using https://github.com/ConsenSys/gnark-crypto/blob/master/ecc/utils.go
// with `pasta_curves::Fq::ZETA`
// See https://github.com/demining/Endomorphism-Secp256k1/blob/main/README.md
// to have more details about the endomorphism.
const ENDO_PARAMS_EP: EndoParameters = EndoParameters {
// round(b2/n)
gamma1: [0x32c49e4bffffffff, 0x279a745902a2654e, 0x1, 0x0],
// round(-b1/n)
gamma2: [0x31f0256800000002, 0x4f34e8b2066389a4, 0x2, 0x0],
b1: [0x8cb1279300000000, 0x49e69d1640a89953, 0x0, 0x0],
b2: [0x0c7c095a00000001, 0x93cd3a2c8198e269, 0x0, 0x0],
Expand Down

0 comments on commit de71b18

Please sign in to comment.