This commit is contained in:
Paul Miller 2023-08-08 13:43:31 +00:00
parent 08bb00cc8f
commit 8c48abe16a
No known key found for this signature in database
GPG Key ID: 697079DA6878B89B

@ -27,8 +27,7 @@ export function validateOpts(opts: PoseidonOpts) {
// Default is 5, but for some reasons stark uses 3
let { sboxPower } = opts;
if (sboxPower === undefined) sboxPower = 5;
if (!([3, 5, 7].includes(sboxPower)))
throw new Error(`Poseidon wrong sboxPower=${sboxPower}`);
if (![3, 5, 7].includes(sboxPower)) throw new Error(`Poseidon wrong sboxPower=${sboxPower}`);
const _sboxPower = BigInt(sboxPower);
let sboxFn = (n: bigint) => FpPow(Fp, n, _sboxPower);