From 95a09e5d8a7a273901b453bf9f32f1d69cbd2a27 Mon Sep 17 00:00:00 2001 From: bellesmarta Date: Mon, 10 Sep 2018 11:53:09 +0200 Subject: [PATCH] Changes README, copyright and typos --- .gitignore | 2 ++ README.md | 22 +++++++------- aux/calculate2roots.js | 66 ---------------------------------------- index.js | 24 +++++++-------- package.json | 2 +- src/bigint.js | 24 +++++++-------- src/bn128.js | 25 +++++++-------- src/calculateWitness.js | 27 ++++++++-------- src/circuit.js | 25 +++++++-------- src/f2field.js | 25 +++++++-------- src/f3field.js | 25 +++++++-------- src/futils.js | 25 +++++++-------- src/gcurve.js | 25 +++++++-------- src/polfield.js | 30 +++++++++--------- src/prover.js | 24 +++++++-------- src/ratfield.js | 24 +++++++-------- src/setup.js | 24 +++++++-------- src/verifier.js | 24 +++++++-------- src/zqfield.js | 24 +++++++-------- test/algebra.js | 26 ++++++++-------- test/calculatewitness.js | 27 ++++++++-------- test/pols.js | 26 ++++++++-------- test/ratzqfield.js | 25 +++++++-------- test/zksnark.js | 27 ++++++++-------- 24 files changed, 272 insertions(+), 326 deletions(-) delete mode 100644 aux/calculate2roots.js diff --git a/.gitignore b/.gitignore index 8b18f83..50d8b98 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,5 @@ typings/ .next tmp + +.DS_Store \ No newline at end of file diff --git a/README.md b/README.md index 33b6641..6d64262 100644 --- a/README.md +++ b/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 @@ const circuit = new zkSnark.Circuit(circuitDef); // 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), "ut setup.toxic // Must be discarded. ``` -### Generate proof +### Generate proof. ``` const circuitDef = JSON.parse(fs.readFileSync("myCircuit.cir", "utf8")); @@ -99,7 +99,7 @@ const vk_proof = JSON.parse(fs.readFileSync("myCircuit.vk_proof", "utf8")); const {proof, publicSignals} = zkSnark.genProof(vk_proof, witness); ``` -### Verifier +### Verifier. ``` const vk_verifier = JSON.parse(fs.readFileSync("myCircuit.vk_verifier", "utf8")); diff --git a/aux/calculate2roots.js b/aux/calculate2roots.js deleted file mode 100644 index e68dc93..0000000 --- a/aux/calculate2roots.js +++ /dev/null @@ -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)); diff --git a/index.js b/index.js index 8b69f41..86f4ff3 100644 --- a/index.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ exports.Circuit = require("./src/circuit.js"); diff --git a/package.json b/package.json index ea77e60..4e01cc8 100644 --- a/package.json +++ b/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" diff --git a/src/bigint.js b/src/bigint.js index cfc1ce5..b4e6974 100644 --- a/src/bigint.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ /* global BigInt */ diff --git a/src/bn128.js b/src/bn128.js index ae0cbf0..3d2b0e1 100644 --- a/src/bn128.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const bigInt = require("./bigint.js"); const assert = require("assert"); diff --git a/src/calculateWitness.js b/src/calculateWitness.js index 9d4222b..61d6444 100644 --- a/src/calculateWitness.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ -const bigInt = require("./bigInt"); + +const bigInt = require("./bigint"); module.exports = calculateWitness; diff --git a/src/circuit.js b/src/circuit.js index 351750a..6f2d6c0 100644 --- a/src/circuit.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const bigInt = require("./bigint.js"); const __P__ = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617"); diff --git a/src/f2field.js b/src/f2field.js index f3ab94c..6e78361 100644 --- a/src/f2field.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const fUtils = require("./futils.js"); class F2Field { diff --git a/src/f3field.js b/src/f3field.js index 565ff7c..8e12060 100644 --- a/src/f3field.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const fUtils = require("./futils.js"); class F3Field { diff --git a/src/futils.js b/src/futils.js index 673e573..a5a3a3a 100644 --- a/src/futils.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const bigInt = require("./bigint.js"); exports.mulScalar = (F, base, e) =>{ diff --git a/src/gcurve.js b/src/gcurve.js index a212bbb..ab5772b 100644 --- a/src/gcurve.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const fUtils = require("./futils.js"); class GCurve { diff --git a/src/polfield.js b/src/polfield.js index d44b145..fb55405 100644 --- a/src/polfield.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ /* - 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"); diff --git a/src/prover.js b/src/prover.js index 2f90eb5..56c4edb 100644 --- a/src/prover.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ const BN128 = require("./bn128.js"); diff --git a/src/ratfield.js b/src/ratfield.js index 6deb53e..ca2ac29 100644 --- a/src/ratfield.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ const fUtils = require("./futils.js"); diff --git a/src/setup.js b/src/setup.js index 6500470..d729025 100644 --- a/src/setup.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ const bigInt = require("./bigint.js"); diff --git a/src/verifier.js b/src/verifier.js index 2f53431..2053852 100644 --- a/src/verifier.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ const BN128 = require("./bn128.js"); diff --git a/src/zqfield.js b/src/zqfield.js index 59ae8aa..38c3460 100644 --- a/src/zqfield.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ const crypto = require("crypto"); diff --git a/test/algebra.js b/test/algebra.js index cf9eaeb..6b87be7 100644 --- a/test/algebra.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const chai = require("chai"); const bigInt = require("../src/bigint.js"); @@ -44,7 +45,6 @@ describe("F1 testing", () => { }); }); - describe("Curve G1 Test", () => { it("r*one == 0", () => { const bn128 = new BN128(); diff --git a/test/calculatewitness.js b/test/calculatewitness.js index f2500c3..a4e3d56 100644 --- a/test/calculatewitness.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + 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; diff --git a/test/pols.js b/test/pols.js index fb65966..5088613 100644 --- a/test/pols.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const chai = require("chai"); const bigInt = require("../src/bigint.js"); @@ -96,7 +97,6 @@ describe("Polynomial field", () => { assert(PF.equals(a, d)); }); - it("Should div big/small", () => { const PF = new PolField(new ZqField(r)); diff --git a/test/ratzqfield.js b/test/ratzqfield.js index a9b9179..edb7b5d 100644 --- a/test/ratzqfield.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const chai = require("chai"); const bigInt = require("../src/bigint.js"); diff --git a/test/zksnark.js b/test/zksnark.js index 2e872f4..8107822 100644 --- a/test/zksnark.js +++ b/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 . + You should have received a copy of the GNU General Public License along with + zksnark JavaScript library. If not, see . */ + const chai = require("chai"); const fs = require("fs"); const path = require("path"); @@ -60,7 +61,7 @@ function unstringifyBigInts(o) { } 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);