44 lines
1.2 KiB
Text
44 lines
1.2 KiB
Text
#pragma curve bn128
|
|
|
|
// Parameters are based on: https://github.com/HarryR/ethsnarks/tree/9cdf0117c2e42c691e75b98979cb29b099eca998/src/jubjub
|
|
// Note: parameters will be updated soon to be more compatible with zCash's implementation
|
|
|
|
struct BabyJubJubParams {
|
|
field JUBJUBC
|
|
field JUBJUBA
|
|
field JUBJUBD
|
|
field MONTA
|
|
field MONTB
|
|
field[2] INFINITY
|
|
field Gu
|
|
field Gv
|
|
}
|
|
|
|
def main() -> BabyJubJubParams:
|
|
|
|
// Order of the curve E
|
|
field JUBJUBC = 8 // Cofactor
|
|
field JUBJUBA = 168700 // Coefficient A
|
|
field JUBJUBD = 168696 // Coefficient D
|
|
field MONTA = 168698 // int(2*(JUBJUB_A+JUBJUB_D)/(JUBJUB_A-JUBJUB_D))
|
|
field MONTB = 1 // int(4/(JUBJUB_A-JUBJUB_D))
|
|
|
|
// Point at infinity
|
|
field[2] INFINITY = [0, 1]
|
|
|
|
// Generator
|
|
field Gu = 16540640123574156134436876038791482806971768689494387082833631921987005038935
|
|
field Gv = 20819045374670962167435360035096875258406992893633759881276124905556507972311
|
|
|
|
// Index
|
|
// 0 1 2 3 4 5 6 7 8 10
|
|
return BabyJubJubParams {
|
|
JUBJUBA: JUBJUBA,
|
|
JUBJUBD: JUBJUBD,
|
|
INFINITY: INFINITY,
|
|
Gu: Gu,
|
|
Gv: Gv,
|
|
JUBJUBC: JUBJUBC,
|
|
MONTA: MONTA,
|
|
MONTB: MONTB
|
|
}
|