Socket
Socket
Sign inDemoInstall

snarkjs

Package Overview
Dependencies
Maintainers
1
Versions
135
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.6 to 0.1.7

2

package.json
{
"name": "snarkjs",
"version": "0.1.6",
"version": "0.1.7",
"description": "zkSNARKs implementation in JavaScript",

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

@@ -172,2 +172,6 @@ /*

wBigInt.prototype.div = function(c) {
return this / c;
};
wBigInt.prototype.mod = function(c) {

@@ -178,3 +182,13 @@ return this % c;

wBigInt.prototype.modPow = function(e, m) {
return this ** e % m;
let acc = wBigInt.one;
let exp = this;
let rem = e;
while (rem) {
if (rem & wBigInt.one) {
acc = (acc * exp) %m;
}
exp = (exp * exp) % m;
rem = rem >> wBigInt.one;
}
return acc;
};

@@ -223,2 +237,6 @@

wBigInt.prototype.div = function(c) {
return this.divide(c);
};
// Affine

@@ -438,4 +456,27 @@ wBigInt.genAffine = (q) => {

wBigInt.leBuff2int = function(buff) {
let res = wBigInt.zero;
for (let i=0; i<buff.length; i++) {
const n = wBigInt(buff[i]);
res = res.add(n.shl(i*8));
}
return res;
};
wBigInt.leInt2Buff = function(n, len) {
let r = n;
let o =0;
const buff = Buffer.alloc(len);
while ((r.greater(wBigInt.zero))&&(o<buff.length)) {
let c = Number(r.and(wBigInt("255")));
buff[o] = c;
o++;
r = r.shr(8);
}
if (r.greater(wBigInt.zero)) throw new Error("Number does not feed in buffer");
return buff;
};
module.exports = wBigInt;

@@ -55,3 +55,3 @@ /*

if (typeof(ctx.witness[idx]) == "undefined") {
throw new Error("Input Signal not assigned: " + circuit.signalNames(i));
throw new Error("Input Signal not assigned: " + circuit.signalNames(idx));
}

@@ -58,0 +58,0 @@ }

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