mirror of
https://github.com/CryptKeeperZK/snarkjs.git
synced 2026-01-07 22:44:02 -05:00
fix: replacing ffjavascript with forked @cryptkeeperzk/ffjavascript package
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||

|
||||
|
||||
# snarkjs
|
||||
# @cryptkeeperzk/snarkjs
|
||||
> It is a forked version from the main `iden3/snarkjs` repo to make it work with CryptKeeper Browser Extension using `@cryptkeeperzk/ffjavascript` forked version.
|
||||
|
||||
This is a **JavaScript and Pure Web Assembly implementation of zkSNARK and PLONK schemes.** It uses the Groth16 Protocol (3 point only and 3 pairings), PLONK and FFLONK.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
var binFileUtils = require('@iden3/binfileutils');
|
||||
var ffjavascript = require('ffjavascript');
|
||||
var ffjavascript = require('@cryptkeeperzk/ffjavascript');
|
||||
var Blake2b = require('blake2b-wasm');
|
||||
var readline = require('readline');
|
||||
var crypto = require('crypto');
|
||||
|
||||
2
cli.js
2
cli.js
@@ -31,7 +31,7 @@ import clProcessor from "./src/clprocessor.js";
|
||||
|
||||
import * as powersOfTau from "./src/powersoftau.js";
|
||||
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
const {stringifyBigInts} = utils;
|
||||
|
||||
|
||||
96
package-lock.json
generated
96
package-lock.json
generated
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"name": "snarkjs",
|
||||
"version": "0.7.1",
|
||||
"name": "@cryptkeeperzk/snarkjs",
|
||||
"version": "0.7.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "snarkjs",
|
||||
"version": "0.7.1",
|
||||
"name": "@cryptkeeperzk/snarkjs",
|
||||
"version": "0.7.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"@cryptkeeperzk/ffjavascript": "^0.2.59",
|
||||
"@iden3/binfileutils": "0.0.11",
|
||||
"bfj": "^7.0.2",
|
||||
"blake2b-wasm": "^2.4.0",
|
||||
"circom_runtime": "0.1.24",
|
||||
"ejs": "^3.1.6",
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "0.2.60",
|
||||
"js-sha3": "^0.8.0",
|
||||
"logplease": "^1.2.15",
|
||||
"r1csfile": "0.0.47"
|
||||
@@ -151,6 +151,17 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@cryptkeeperzk/ffjavascript": {
|
||||
"version": "0.2.59",
|
||||
"resolved": "https://registry.npmjs.org/@cryptkeeperzk/ffjavascript/-/ffjavascript-0.2.59.tgz",
|
||||
"integrity": "sha512-K5G1dummndLEOVmxmeT9eHx2+R6GK6TM1ClVmWDAXPYi9fS8IkZQHEvMV2mI2AMhAZcnMgIKzoanAhrFOiEPGg==",
|
||||
"dependencies": {
|
||||
"base64-js": "^1.5.1",
|
||||
"wasmbuilder": "0.0.16",
|
||||
"wasmcurves": "0.2.1",
|
||||
"web-worker": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz",
|
||||
@@ -250,8 +261,8 @@
|
||||
"resolved": "https://registry.npmjs.org/@iden3/binfileutils/-/binfileutils-0.0.11.tgz",
|
||||
"integrity": "sha512-LylnJoZ0CTdgErnKY8OxohvW4K+p6UHD3sxt+3P9AmMyBQjYR4IpoqoYZZ+9aMj89cmCQ21UvdhndAx04er3NA==",
|
||||
"dependencies": {
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "^0.2.48"
|
||||
"@cryptkeeperzk/ffjavascript": "^0.2.48",
|
||||
"fastfile": "0.0.20"
|
||||
}
|
||||
},
|
||||
"node_modules/@jridgewell/gen-mapping": {
|
||||
@@ -572,6 +583,25 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/bfj": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bfj/-/bfj-7.0.2.tgz",
|
||||
@@ -739,7 +769,7 @@
|
||||
"resolved": "https://registry.npmjs.org/circom_runtime/-/circom_runtime-0.1.24.tgz",
|
||||
"integrity": "sha512-H7/7I2J/cBmRnZm9docOCGhfxzS61BEm4TMCWcrZGsWNBQhePNfQq88Oj2XpUfzmBTCd8pRvRb3Mvazt3TMrJw==",
|
||||
"dependencies": {
|
||||
"ffjavascript": "0.2.60"
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59"
|
||||
},
|
||||
"bin": {
|
||||
"calcwit": "calcwit.js"
|
||||
@@ -1097,16 +1127,6 @@
|
||||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/ffjavascript": {
|
||||
"version": "0.2.60",
|
||||
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.60.tgz",
|
||||
"integrity": "sha512-T/9bnEL5xAZRDbQoEMf+pM9nrhK+C3JyZNmqiWub26EQorW7Jt+jR54gpqDhceA4Nj0YctPQwYnl8xa52/A26A==",
|
||||
"dependencies": {
|
||||
"wasmbuilder": "0.0.16",
|
||||
"wasmcurves": "0.2.2",
|
||||
"web-worker": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@@ -2005,10 +2025,10 @@
|
||||
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.47.tgz",
|
||||
"integrity": "sha512-oI4mAwuh1WwuFg95eJDNDDL8hCaZkwnPuNZrQdLBWvDoRU7EG+L/MOHL7SwPW2Y+ZuYcTLpj3rBkgllBQZN/JA==",
|
||||
"dependencies": {
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59",
|
||||
"@iden3/bigarray": "0.0.2",
|
||||
"@iden3/binfileutils": "0.0.11",
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "0.2.60"
|
||||
"fastfile": "0.0.20"
|
||||
}
|
||||
},
|
||||
"node_modules/randombytes": {
|
||||
@@ -2659,6 +2679,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"@cryptkeeperzk/ffjavascript": {
|
||||
"version": "0.2.59",
|
||||
"resolved": "https://registry.npmjs.org/@cryptkeeperzk/ffjavascript/-/ffjavascript-0.2.59.tgz",
|
||||
"integrity": "sha512-K5G1dummndLEOVmxmeT9eHx2+R6GK6TM1ClVmWDAXPYi9fS8IkZQHEvMV2mI2AMhAZcnMgIKzoanAhrFOiEPGg==",
|
||||
"requires": {
|
||||
"base64-js": "^1.5.1",
|
||||
"wasmbuilder": "0.0.16",
|
||||
"wasmcurves": "0.2.1",
|
||||
"web-worker": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"@eslint-community/eslint-utils": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.2.0.tgz",
|
||||
@@ -2730,8 +2761,8 @@
|
||||
"resolved": "https://registry.npmjs.org/@iden3/binfileutils/-/binfileutils-0.0.11.tgz",
|
||||
"integrity": "sha512-LylnJoZ0CTdgErnKY8OxohvW4K+p6UHD3sxt+3P9AmMyBQjYR4IpoqoYZZ+9aMj89cmCQ21UvdhndAx04er3NA==",
|
||||
"requires": {
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "^0.2.48"
|
||||
"@cryptkeeperzk/ffjavascript": "^0.2.48",
|
||||
"fastfile": "0.0.20"
|
||||
}
|
||||
},
|
||||
"@jridgewell/gen-mapping": {
|
||||
@@ -2980,6 +3011,11 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="
|
||||
},
|
||||
"bfj": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/bfj/-/bfj-7.0.2.tgz",
|
||||
@@ -3105,7 +3141,7 @@
|
||||
"resolved": "https://registry.npmjs.org/circom_runtime/-/circom_runtime-0.1.24.tgz",
|
||||
"integrity": "sha512-H7/7I2J/cBmRnZm9docOCGhfxzS61BEm4TMCWcrZGsWNBQhePNfQq88Oj2XpUfzmBTCd8pRvRb3Mvazt3TMrJw==",
|
||||
"requires": {
|
||||
"ffjavascript": "0.2.60"
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59"
|
||||
}
|
||||
},
|
||||
"cliui": {
|
||||
@@ -3374,16 +3410,6 @@
|
||||
"reusify": "^1.0.4"
|
||||
}
|
||||
},
|
||||
"ffjavascript": {
|
||||
"version": "0.2.60",
|
||||
"resolved": "https://registry.npmjs.org/ffjavascript/-/ffjavascript-0.2.60.tgz",
|
||||
"integrity": "sha512-T/9bnEL5xAZRDbQoEMf+pM9nrhK+C3JyZNmqiWub26EQorW7Jt+jR54gpqDhceA4Nj0YctPQwYnl8xa52/A26A==",
|
||||
"requires": {
|
||||
"wasmbuilder": "0.0.16",
|
||||
"wasmcurves": "0.2.2",
|
||||
"web-worker": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"file-entry-cache": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
|
||||
@@ -4045,10 +4071,10 @@
|
||||
"resolved": "https://registry.npmjs.org/r1csfile/-/r1csfile-0.0.47.tgz",
|
||||
"integrity": "sha512-oI4mAwuh1WwuFg95eJDNDDL8hCaZkwnPuNZrQdLBWvDoRU7EG+L/MOHL7SwPW2Y+ZuYcTLpj3rBkgllBQZN/JA==",
|
||||
"requires": {
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59",
|
||||
"@iden3/bigarray": "0.0.2",
|
||||
"@iden3/binfileutils": "0.0.11",
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "0.2.60"
|
||||
"fastfile": "0.0.20"
|
||||
}
|
||||
},
|
||||
"randombytes": {
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
{
|
||||
"name": "snarkjs",
|
||||
"name": "@cryptkeeperzk/snarkjs",
|
||||
"type": "module",
|
||||
"version": "0.7.1",
|
||||
"description": "zkSNARKs implementation in JavaScript",
|
||||
"description": "zkSNARKs implementation in JavaScript, is a forked version from the main `iden3/snarkjs` repo to make it work with CryptKeeper Browser Extension using `@cryptkeeperzk/ffjavascript` forked version.",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./build/main.cjs",
|
||||
"module": "./main.js",
|
||||
"exports": {
|
||||
@@ -48,13 +51,13 @@
|
||||
"url": "https://github.com/iden3/snarkjs.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cryptkeeperzk/ffjavascript": "^0.2.59",
|
||||
"@iden3/binfileutils": "0.0.11",
|
||||
"bfj": "^7.0.2",
|
||||
"blake2b-wasm": "^2.4.0",
|
||||
"circom_runtime": "0.1.24",
|
||||
"ejs": "^3.1.6",
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "0.2.60",
|
||||
"js-sha3": "^0.8.0",
|
||||
"logplease": "^1.2.15",
|
||||
"r1csfile": "0.0.47"
|
||||
|
||||
4
smart_contract_tests/package-lock.json
generated
4
smart_contract_tests/package-lock.json
generated
@@ -11,7 +11,7 @@
|
||||
"chai": "^4.3.7",
|
||||
"ethereum-waffle": "^4.0.10",
|
||||
"ethers": "^5.7.2",
|
||||
"ffjavascript": "0.2.59",
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59",
|
||||
"hardhat": "^2.14.0",
|
||||
"mocha": "^10.2.0",
|
||||
"snarkjs": "file:.."
|
||||
@@ -28,7 +28,7 @@
|
||||
"circom_runtime": "0.1.22",
|
||||
"ejs": "^3.1.6",
|
||||
"fastfile": "0.0.20",
|
||||
"ffjavascript": "0.2.59",
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59",
|
||||
"js-sha3": "^0.8.0",
|
||||
"logplease": "^1.2.15",
|
||||
"r1csfile": "0.0.45"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"chai": "^4.3.7",
|
||||
"ethereum-waffle": "^4.0.10",
|
||||
"ethers": "^5.7.2",
|
||||
"ffjavascript": "0.2.59",
|
||||
"@cryptkeeperzk/ffjavascript": "0.2.59",
|
||||
"hardhat": "^2.14.0",
|
||||
"mocha": "^10.2.0",
|
||||
"snarkjs": "file:.."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
|
||||
import { buildBn128 } from "ffjavascript";
|
||||
import { buildBn128 } from "@cryptkeeperzk/ffjavascript";
|
||||
import path from "path";
|
||||
import hardhat from "hardhat";
|
||||
const { ethers, run } = hardhat;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
snarkjs. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Scalar} from "ffjavascript";
|
||||
import {Scalar} from "@cryptkeeperzk/ffjavascript";
|
||||
import jsSha3 from "js-sha3";
|
||||
const { keccak256 } = jsSha3;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Scalar, buildBn128, buildBls12381} from "ffjavascript";
|
||||
import { Scalar, buildBn128, buildBls12381} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
const bls12381r = Scalar.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
||||
const bn128r = Scalar.e("21888242871839275222246405745257275088548364400416034343698204186575808495617");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import {getCurveFromName} from "./curves.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
import ejs from "ejs";
|
||||
import {getCurveFromName} from "./curves.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
const {unstringifyBigInts, stringifyBigInts} = utils;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import fflonkProve from "./fflonk_prove.js";
|
||||
import wtns_calculate from "./wtns_calculate.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
export default async function fflonkFullProve(_input, wasmFilename, zkeyFilename, logger) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as zkeyUtils from "./zkey_utils.js";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import { BigBuffer, Scalar, utils } from "ffjavascript";
|
||||
import { BigBuffer, Scalar, utils } from "@cryptkeeperzk/ffjavascript";
|
||||
import { FFLONK_PROTOCOL_ID } from "./zkey_constants.js";
|
||||
import {
|
||||
ZKEY_FF_A_MAP_SECTION,
|
||||
|
||||
@@ -21,7 +21,7 @@ import {readR1csFd} from "r1csfile";
|
||||
import * as utils from "./powersoftau_utils.js";
|
||||
import {createBinFile, endWriteSection, readBinFile, startWriteSection, writeBigInt,} from "@iden3/binfileutils";
|
||||
import {log2} from "./misc.js";
|
||||
import {BigBuffer, Scalar} from "ffjavascript";
|
||||
import {BigBuffer, Scalar} from "@cryptkeeperzk/ffjavascript";
|
||||
import BigArray from "./bigarray.js";
|
||||
import {
|
||||
ZKEY_FF_HEADER_SECTION,
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
|
||||
import * as curves from "./curves.js";
|
||||
import { BigBuffer, utils } from "ffjavascript";
|
||||
import { BigBuffer, utils } from "@cryptkeeperzk/ffjavascript";
|
||||
import { Proof } from "./proof.js";
|
||||
import { Keccak256Transcript } from "./Keccak256Transcript.js";
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
const { unstringifyBigInts } = utils;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const { unstringifyBigInts} = utils;
|
||||
|
||||
function p256(n) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
import groth16_prove from "./groth16_prove.js";
|
||||
import wtns_calculate from "./wtns_calculate.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
export default async function groth16FullProve(_input, wasmFile, zkeyFileName, logger) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import * as zkeyUtils from "./zkey_utils.js";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import { getCurveFromQ as getCurve } from "./curves.js";
|
||||
import { log2 } from "./misc.js";
|
||||
import { Scalar, utils, BigBuffer } from "ffjavascript";
|
||||
import { Scalar, utils, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
const {stringifyBigInts} = utils;
|
||||
|
||||
export default async function groth16Prove(zkeyFileName, witnessFileName, logger) {
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
/* Implementation of this paper: https://eprint.iacr.org/2016/260.pdf */
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
import * as curves from "./curves.js";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
export default async function groth16Verify(_vk_verifier, _publicSignals, _proof, logger) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
import blake2b from "blake2b-wasm";
|
||||
|
||||
import { ChaCha } from "ffjavascript";
|
||||
import { ChaCha } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export function hashToG2(curve, hash) {
|
||||
const hashV = new DataView(hash.buffer, hash.byteOffset, hash.byteLength);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
/* global window */
|
||||
import Blake2b from "blake2b-wasm";
|
||||
import readline from "readline";
|
||||
import { ChaCha } from "ffjavascript";
|
||||
import { ChaCha } from "@cryptkeeperzk/ffjavascript";
|
||||
import crypto from "crypto";
|
||||
|
||||
const _revTable = [];
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
import { getCurveFromName } from "./curves.js";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const { unstringifyBigInts} = utils;
|
||||
|
||||
function i2hex(i) {
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
import plonk_prove from "./plonk_prove.js";
|
||||
import wtns_calculate from "./wtns_calculate.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
export default async function plonkFullProve(_input, wasmFile, zkeyFileName, logger) {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as zkeyUtils from "./zkey_utils.js";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import { Scalar, utils, BigBuffer } from "ffjavascript";
|
||||
import { Scalar, utils, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
const {stringifyBigInts} = utils;
|
||||
import { Proof } from "./proof.js";
|
||||
import { Keccak256Transcript } from "./Keccak256Transcript.js";
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
endWriteSection,
|
||||
} from "@iden3/binfileutils";
|
||||
import { log2 } from "./misc.js";
|
||||
import { Scalar, BigBuffer } from "ffjavascript";
|
||||
import { Scalar, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
import Blake2b from "blake2b-wasm";
|
||||
import BigArray from "./bigarray.js";
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
/* Implementation of this paper: https://eprint.iacr.org/2019/953.pdf */
|
||||
import * as curves from "./curves.js";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
import { Keccak256Transcript } from "./Keccak256Transcript.js";
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
// We can use this class to avoid the allocation of a big memory buffer
|
||||
// for the coefficients because in some cases a big number of the coefficients are zero
|
||||
|
||||
import {BigBuffer} from "ffjavascript";
|
||||
import {BigBuffer} from "@cryptkeeperzk/ffjavascript";
|
||||
import {log2} from "../misc.js";
|
||||
import {Polynomial} from "./polynomial.js";
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
snarkjs. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {BigBuffer} from "ffjavascript";
|
||||
import {BigBuffer} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export class Evaluations {
|
||||
constructor(evaluations, curve, logger) {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
snarkjs. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {BigBuffer} from "ffjavascript";
|
||||
import {BigBuffer} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export class Polynomial {
|
||||
constructor(coefficients, curve, logger) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as utils from "./powersoftau_utils.js";
|
||||
import * as fastFile from "fastfile";
|
||||
import {BigBuffer} from "ffjavascript";
|
||||
import {BigBuffer} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export default async function convert(oldPtauFilename, newPTauFilename, logger) {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as utils from "./powersoftau_utils.js";
|
||||
import {BigBuffer} from "ffjavascript";
|
||||
import {BigBuffer} from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export default async function preparePhase2(oldPtauFilename, newPTauFilename, logger) {
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
import Blake2b from "blake2b-wasm";
|
||||
import * as keyPair from "./keypair.js";
|
||||
import * as misc from "./misc.js";
|
||||
|
||||
@@ -21,7 +21,7 @@ import Blake2b from "blake2b-wasm";
|
||||
import * as utils from "./powersoftau_utils.js";
|
||||
import * as keyPair from "./keypair.js";
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import { ChaCha, BigBuffer } from "ffjavascript";
|
||||
import { ChaCha, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
import * as misc from "./misc.js";
|
||||
const sameRatio = misc.sameRatio;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
import { readR1cs } from "r1csfile";
|
||||
|
||||
const bls12381r = Scalar.e("73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001", 16);
|
||||
|
||||
@@ -21,7 +21,7 @@ import * as fastFile from "fastfile";
|
||||
import { WitnessCalculatorBuilder } from "circom_runtime";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const { unstringifyBigInts} = utils;
|
||||
|
||||
export default async function wtnsCalculate(_input, wasmFileName, wtnsFileName, options) {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import { readR1csFd } from "r1csfile";
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
import * as curves from "./curves.js";
|
||||
|
||||
export default async function wtnsCheck(r1csFilename, wtnsFilename, logger) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import { WitnessCalculatorBuilder } from "circom_runtime";
|
||||
import * as wtnsUtils from "./wtns_utils.js";
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import loadSyms from "./loadsyms.js";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const {unstringifyBigInts} = utils;
|
||||
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
along with snarkJS. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { readZKey as readZKey } from "./zkey_utils.js";
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
export default async function zkeyExportJson(zkeyFileName) {
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
import * as zkeyUtils from "./zkey_utils.js";
|
||||
import {getCurveFromQ as getCurve} from "./curves.js";
|
||||
import {utils} from "ffjavascript";
|
||||
import {utils} from "@cryptkeeperzk/ffjavascript";
|
||||
import {FFLONK_PROTOCOL_ID} from "./zkey_constants.js";
|
||||
|
||||
const {stringifyBigInts} = utils;
|
||||
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
endWriteSection,
|
||||
} from "@iden3/binfileutils";
|
||||
import { log2, formatHash } from "./misc.js";
|
||||
import { Scalar, BigBuffer } from "ffjavascript";
|
||||
import { Scalar, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
import Blake2b from "blake2b-wasm";
|
||||
import BigArray from "./bigarray.js";
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
// PointsH(9)
|
||||
// Contributions(10)
|
||||
|
||||
import { Scalar, F1Field } from "ffjavascript";
|
||||
import { Scalar, F1Field } from "@cryptkeeperzk/ffjavascript";
|
||||
import * as binFileUtils from "@iden3/binfileutils";
|
||||
|
||||
import { getCurveFromQ as getCurve } from "./curves.js";
|
||||
|
||||
@@ -25,7 +25,7 @@ import * as misc from "./misc.js";
|
||||
import { hashToG2 as hashToG2 } from "./keypair.js";
|
||||
const sameRatio = misc.sameRatio;
|
||||
import {hashG1, hashPubKey} from "./zkey_utils.js";
|
||||
import { Scalar, ChaCha, BigBuffer } from "ffjavascript";
|
||||
import { Scalar, ChaCha, BigBuffer } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import path from "path";
|
||||
import bfj from "bfj";
|
||||
import assert from "assert";
|
||||
|
||||
import { utils } from "ffjavascript";
|
||||
import { utils } from "@cryptkeeperzk/ffjavascript";
|
||||
const { stringifyBigInts } = utils;
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from "assert";
|
||||
import { getCurveFromName } from "../src/curves.js";
|
||||
import { hex2ByteArray } from "../src/misc.js";
|
||||
import { Scalar } from "ffjavascript";
|
||||
import { Scalar } from "@cryptkeeperzk/ffjavascript";
|
||||
|
||||
import { getG2sp } from "../src/keypair.js";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user