arnaucube
arnaucube/snarkjsPublic Self-hosted repository
Merge pull request #1 from bellesmarta/master

Changes README, copyright and typos
Jordi Baylina jordi@baylina.cat
Wed, 12 Sep 2018 11:04:21 +0200
commit

d425a48092df8381f5694a0fbf2861b12ccd4a21

parent

606857265532153d7513f398dae86b03275c1b1b

M .gitignore → .gitignore

@@ -61,3 +61,5 @@ # next.js build output

.next tmp + +.DS_Store
M README.md → README.md

@@ -1,20 +1,20 @@

-# javascript implementation of zkSnark +# JavaScript implementation of zkSNARKs. -This is a javascript implementation of zkSnarks. +This is a JavaScript implementation of zkSNARK schemes. -This library allows to do the trusted setup, generate proofs and verify the proofs. +This library allows to do the trusted setup, generate proofs and verify the proofs. This library uses the compiled circuits generated by the jaz compiler. -## Install +## Install. ``` -npm install zkSnark +npm install zksnark ``` -## Usage +## Usage. -### import +### Import. ``` const zkSnark = require("zksnark");

@@ -71,11 +71,11 @@ circuit.signalNames(signalId)

// input is a key value object where keys are the signal names // of all the inputs (public and private) - // returns an array of values that represent the witness + // returns an array of values representing the witness circuit.calculateWitness(input) ``` -### Trusted setup +### Trusted setup. ``` const setup = zkSnark.setup(circuit);

@@ -84,7 +84,7 @@ fs.writeFileSink("myCircuit.vk_verifier", JSON.stringify(setup.vk_verifier), "utf8");

setup.toxic // Must be discarded. ``` -### Generate proof +### Generate proof. ``` const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8"));

@@ -99,7 +99,7 @@

const {proof, publicSignals} = zkSnark.genProof(vk_proof, witness); ``` -### Verifier +### Verifier. ``` const vk_verifier = JSON.parse(fs.readFileSync("myCircuit.vk_verifier", "utf8"));
D aux/calculate2roots.js

@@ -1,66 +0,0 @@

- -const bigInt = require("../src/bigint.js"); -const ZqField = require("../src/zqfield.js"); - - -const r = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); -const s = 28; -const nqr_to_t = bigInt("19103219067921713944291392827692070036145651957329286315305642004821462161904"); -const t_minus_1_over_2 = bigInt("40770029410420498293352137776570907027550720424234931066070132305055"); -const root_unity = bigInt("19103219067921713944291392827692070036145651957329286315305642004821462161904"); -const t = bigInt("81540058820840996586704275553141814055101440848469862132140264610111"); - -const F = new ZqField(r); - -function sqrt(a) { - - let v = s; - let z = nqr_to_t; - let w = F.exp(a, t_minus_1_over_2); - let x = F.mul(a, w); - let b = F.mul(x, w); - - - // compute square root with Tonelli--Shanks - // (does not terminate if not a square!) - - while (!F.equals(b, F.one)) - { - let m = 0; - let b2m = b; - while (!F.equals(b2m, F.one)) - { - /* invariant: b2m = b^(2^m) after entering this loop */ - b2m = F.square(b2m); - m += 1; - } - - let j = v-m-1; - w = z; - while (j > 0) - { - w = F.square(w); - --j; - } // w = z^2^(v-m-1) - - z = F.square(w); - b = F.mul(b, z); - x = F.mul(x, w); - v = m; - } - - return x; -} - -const p_minus1= F.sub(r,bigInt(1)); -const gen = bigInt(bigInt(5)); -const twoto28= F.exp(bigInt(2), bigInt(28)); -const rem = F.div(p_minus1, twoto28); -const w28 = F.exp(gen, rem); - -const one = F.exp(w28, twoto28); - - -console.log(F.toString(w28)); -console.log(w28.toString(10)); -console.log(F.toString(one));
M index.js → index.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ exports.Circuit = require("./src/circuit.js");
M package.json → package.json

@@ -1,7 +1,7 @@

{ "name": "zksnark", "version": "0.0.5", - "description": "zkSnark implementation in javascript", + "description": "zkSNARKs implementation in JavaScript", "main": "index.js", "scripts": { "test": "mocha"
M src/bigint.js → src/bigint.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ /* global BigInt */
M src/bn128.js → src/bn128.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const bigInt = require("./bigint.js"); const assert = require("assert");
M src/calculateWitness.js → src/calculateWitness.js

@@ -1,22 +1,23 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ -const bigInt = require("./bigInt"); + +const bigInt = require("./bigint"); module.exports = calculateWitness;
M src/circuit.js → src/circuit.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const bigInt = require("./bigint.js"); const __P__ = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
M src/f2field.js → src/f2field.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const fUtils = require("./futils.js"); class F2Field {
M src/f3field.js → src/f3field.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const fUtils = require("./futils.js"); class F3Field {
M src/futils.js → src/futils.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const bigInt = require("./bigint.js"); exports.mulScalar = (F, base, e) =>{
M src/gcurve.js → src/gcurve.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const fUtils = require("./futils.js"); class GCurve {
M src/polfield.js → src/polfield.js

@@ -1,27 +1,27 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ /* - This library do operations on polynomials where their coefficients are in field F + This library does operations on polynomials with coefficients in a field F. - The polynomial P(x) = p0 + p1 * x + p2 * x^2 + p3 * x^3, ... - is represented by the array [ p0, p1, p2, p3, ... ] + A polynomial P(x) = p0 + p1 * x + p2 * x^2 + ... + pn * x^n is represented + by the array [ p0, p1, p2, ... , pn ]. */ const bigInt = require("./bigint.js");
M src/prover.js → src/prover.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ const BN128 = require("./bn128.js");
M src/ratfield.js → src/ratfield.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ const fUtils = require("./futils.js");
M src/setup.js → src/setup.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ const bigInt = require("./bigint.js");
M src/verifier.js → src/verifier.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ const BN128 = require("./bn128.js");
M src/zqfield.js → src/zqfield.js

@@ -1,20 +1,20 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ const crypto = require("crypto");
M test/algebra.js → test/algebra.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const chai = require("chai"); const bigInt = require("../src/bigint.js");

@@ -43,7 +44,6 @@

assert(bn128.F1.equals(a, d)); }); }); - describe("Curve G1 Test", () => { it("r*one == 0", () => {
M test/calculatewitness.js → test/calculatewitness.js

@@ -1,27 +1,28 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const chai = require("chai"); const fs = require("fs"); const path = require("path"); const Circuit = require("../src/circuit.js"); -const BN128 = require("../src/BN128.js"); +const BN128 = require("../src/bn128.js"); const F1Field = require("../src/zqfield.js"); const assert = chai.assert;
M test/pols.js → test/pols.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const chai = require("chai"); const bigInt = require("../src/bigint.js");

@@ -96,7 +97,6 @@ const d = PF.div(c,b);

assert(PF.equals(a, d)); }); - it("Should div big/small", () => { const PF = new PolField(new ZqField(r));
M test/ratzqfield.js → test/ratzqfield.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const chai = require("chai"); const bigInt = require("../src/bigint.js");
M test/zksnark.js → test/zksnark.js

@@ -1,21 +1,22 @@

/* - Copyright 2018 0kims association + Copyright 2018 0kims association. - This file is part of zksnark javascript library. + This file is part of zksnark JavaScript library. - zksnark javascript library is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + zksnark JavaScript library is a free software: you can redistribute it and/or + modify it under the terms of the GNU General Public License as published by the + Free Software Foundation, either version 3 of the License, or (at your option) + any later version. - zksnark javascript library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + zksnark JavaScript library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. - You should have received a copy of the GNU General Public License - along with zksnark javascript library. If not, see <https://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see <https://www.gnu.org/licenses/>. */ + const chai = require("chai"); const fs = require("fs"); const path = require("path");

@@ -60,7 +61,7 @@ }

} describe("zkSnark", () => { - it("Load a circuit, create trusted setup, create a proof and validate", () => { + it("Load a circuit, create trusted setup, create a proof and validate it", () => { const cirDef = JSON.parse(fs.readFileSync(path.join(__dirname, "circuit", "sum.json"), "utf8")); const cir = new Circuit(cirDef);