Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snarkjs

Package Overview
Dependencies
Maintainers
1
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snarkjs - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

44

cli.js

@@ -186,3 +186,27 @@ #!/usr/bin/env node

circuit info
============
snarkjs info <options>
Print statistics of a circuit
-c or --circuit <circuitFile>
Filename of the compiled circuit file generated by circom.
Default: circuit.json
print constraints
=================
snarkjs printconstraints <options>
Print all the constraints of a given circuit
-c or --circuit <circuitFile>
Filename of the compiled circuit file generated by circom.
Default: circuit.json
`)

@@ -223,5 +247,21 @@ .alias("c", "circuit")

try {
if (argv._[0].toUpperCase() == "SETUP") {
if (argv._[0].toUpperCase() == "INFO") {
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8"));
const cir = new zkSnark.Circuit(cirDef);
console.log(`# Wires: ${cir.nVars}`);
console.log(`# Constraints: ${cir.nConstraints}`);
console.log(`# Private Inputs: ${cir.nPrvInputs}`);
console.log(`# Public Inputs: ${cir.nPubInputs}`);
console.log(`# Outputs: ${cir.nOutputs}`);
} else if (argv._[0].toUpperCase() == "PRINTCONSTRAINTS") {
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8"));
const cir = new zkSnark.Circuit(cirDef);
cir.printConstraints();
} else if (argv._[0].toUpperCase() == "SETUP") {
const cirDef = JSON.parse(fs.readFileSync(circuitName, "utf8"));
const cir = new zkSnark.Circuit(cirDef);
const setup = zkSnark.setup(cir);

@@ -327,3 +367,3 @@

inputs = "";
let inputs = "";
for (let i=0; i<public.length; i++) {

@@ -330,0 +370,0 @@ if (inputs != "") inputs = inputs + ",";

2

package.json
{
"name": "snarkjs",
"version": "0.1.3",
"version": "0.1.4",
"description": "zkSNARKs implementation in JavaScript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -96,3 +96,4 @@ /*

for (let k in lc) {
const name = this.signals[k].names[0];
let name = this.signals[k].names[0];
if (name == "one") name = "";
let v = bigInt(lc[k]);

@@ -104,3 +105,10 @@ let vs;

} else {
vs = "+"+v.toString();
if (S!="") {
vs = "+"+v.toString();
} else {
vs = "";
}
if (vs!="1") {
vs = vs + v.toString();;
}
}

@@ -111,7 +119,13 @@

return S;
}
const S = `[ ${lc2str(c[0])} ] * [ ${lc2str(c[1])} ] - [ ${lc2str(c[2])} ]`;
};
const S = `[ ${lc2str(c[0])} ] * [ ${lc2str(c[1])} ] - [ ${lc2str(c[2])} ] = 0`;
console.log(S);
}
printConstraints() {
for (let i=0; i<this.constraints.length; i++) {
this.printCostraint(this.constraints[i]);
}
}
getSignalIdx(name) {

@@ -118,0 +132,0 @@ if (typeof(this.signalName2Idx[name]) != "undefined") return this.signalName2Idx[name];

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc