Changes README, copyright and typos

This commit is contained in:
bellesmarta 2018-09-10 11:53:09 +02:00
parent 6068572655
commit 95a09e5d8a
24 changed files with 272 additions and 326 deletions

2
.gitignore vendored
View File

@ -61,3 +61,5 @@ typings/
.next
tmp
.DS_Store

View File

@ -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 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"));

View File

@ -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));

View File

@ -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");

View File

@ -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"

View File

@ -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 */

View File

@ -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");

View File

@ -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;

View File

@ -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");

View File

@ -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 {

View File

@ -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 {

View File

@ -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) =>{

View File

@ -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 {

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");

View File

@ -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");
@ -44,7 +45,6 @@ describe("F1 testing", () => {
});
});
describe("Curve G1 Test", () => {
it("r*one == 0", () => {
const bn128 = new BN128();

View File

@ -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;

View File

@ -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 @@ describe("Polynomial field", () => {
assert(PF.equals(a, d));
});
it("Should div big/small", () => {
const PF = new PolField(new ZqField(r));

View File

@ -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");

View File

@ -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 @@ 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);