arnaucube
arnaucube/go-iden3-cryptoPublic Self-hosted repository
go-iden3-crypto/constants/constants.go
constants/constants.goRaw
 1package constants
 2
 3import (
 4	"fmt"
 5	"math/big"
 6
 7	"github.com/iden3/go-iden3-crypto/ff"
 8)
 9
10// Q is the order of the integer field (Zq) that fits inside the SNARK.
11var Q *big.Int
12var QE *ff.Element
13
14// Zero is 0.
15var Zero *big.Int
16
17// One is 1.
18var One *big.Int
19
20// MinusOne is -1.
21var MinusOne *big.Int
22
23func init() {
24	Zero = big.NewInt(0)
25	One = big.NewInt(1)
26	MinusOne = big.NewInt(-1)
27
28	qString := "21888242871839275222246405745257275088548364400416034343698204186575808495617"
29	var ok bool
30	Q, ok = new(big.Int).SetString(qString, 10)
31	if !ok {
32		panic(fmt.Sprintf("Bad base 10 string %s", qString))
33	}
34}