mirror of
https://github.com/arnaucube/go-iden3-crypto.git
synced 2026-02-07 11:36:41 +01:00
Poseidon Sponge Hash with different frame sizes (#52)
* Poseidon Sponge Hash with different frame sizes * Update deps. Bump go version * Update & fix linter. * Refactor a bit. * Reduce gc pressure
This commit is contained in:
committed by
GitHub
parent
edc36bfa52
commit
e5cf066b8b
@@ -1,31 +1,19 @@
|
||||
package constants
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
)
|
||||
|
||||
const qString = "21888242871839275222246405745257275088548364400416034343698204186575808495617"
|
||||
|
||||
// Q is the order of the integer field (Zq) that fits inside the SNARK.
|
||||
var Q *big.Int
|
||||
var Q, _ = new(big.Int).SetString(qString, 10)
|
||||
|
||||
// Zero is 0.
|
||||
var Zero *big.Int
|
||||
var Zero = big.NewInt(0)
|
||||
|
||||
// One is 1.
|
||||
var One *big.Int
|
||||
var One = big.NewInt(1)
|
||||
|
||||
// MinusOne is -1.
|
||||
var MinusOne *big.Int
|
||||
|
||||
func init() {
|
||||
Zero = big.NewInt(0)
|
||||
One = big.NewInt(1)
|
||||
MinusOne = big.NewInt(-1)
|
||||
|
||||
qString := "21888242871839275222246405745257275088548364400416034343698204186575808495617"
|
||||
var ok bool
|
||||
Q, ok = new(big.Int).SetString(qString, 10) //nolint:gomnd
|
||||
if !ok {
|
||||
panic(fmt.Sprintf("Bad base 10 string %s", qString))
|
||||
}
|
||||
}
|
||||
var MinusOne = big.NewInt(-1)
|
||||
|
||||
Reference in New Issue
Block a user